Menu

#2746 Failed to calculate offset of struct member

closed-out-of-date
nobody
None
Front-end
6
2025-08-09
2018-05-07
No

When compiling for target stm8, the following code cause error "Internal error: validateOpType failed in OP_VALUE(op) @ SDCCicode.c:1153: expected value, got symbol"

struct object_t
{
    uint8_t field1;
    uint8_t field2;
};
(intptr_t)(&(((struct object_t*)0)->field2));

SDCC version: SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.7.1 #10392 (Linux)

PS: the same code works on 3.6.0 & 3.7.0.
PPS: the builtin macro offsetof works fine.

Related

Wiki: NGI0-Commons-SDCC

Discussion

  • Philipp Klaus Krause

    • Category: STM8 --> other
     
  • Philipp Klaus Krause

    I can reproduce the issue, and confirm that it is a regression from 3.7.0.
    It is not stm8-specific though, it fails for all backends I tried (stm8, mcs51, z80).

    Philipp

     
  • Sergey Belyashov

    • Category: other --> Front-end
    • Priority: 5 --> 6
     
  • Philipp Klaus Krause

    Works for me in SDCC from current svn trunk.

     
  • Philipp Klaus Krause

    • status: open --> closed-out-of-date
     

Log in to post a comment.

MongoDB Logo MongoDB