Menu ▾ ▴

#2874 Failed to allocate symbol to memory segment due to missing output storage class

closed-fixed
None
PDK
5
2023-05-10
2019-02-12
No

Some regression tests fail to compile for pdk14:

bug-2551.c
bug-2554.c
bug-2558.c

For all 3, the error message is "error 9: FATAL Compiler Internal Error in file 'SDCCmem.c' line number '388' : Failed to allocate symbol to memory segment due to missing output storage class"

Philipp

Related

Wiki: NGI0-Entrust-SDCC

Discussion

  • Philipp Klaus Krause

    Also affected by this bug:

    bug-2559.c
    support/regression/tests/gcc-torture-execute-920721-3.c
    support/regression/tests/gcc-torture-execute-20050106-1.c
    support/regression/tests/gcc-torture-execute-20060930-2.c

    What they all have in common is the use of static inline functions.

    Philipp

     
  • Erik Petrich

    Erik Petrich - 2019-02-13

    Perhaps try initializing port->mem.default_local_map and port->mem.default_globl_map to data instead of 0? I realize that the other ports are not doing this, but these will be the assigned output storage class if nothing else is assigned. Since this is just happening on pdk14, I find it more likely that it is attempting to assign an output storage class but some value(s) in the port struct is confusing it rather than it failing to assign an output storage class at all.

     
    • Philipp Klaus Krause

      For now, I'm not confident enough in my knowledge of that part of SDCC to try that, and make pdk14/pdk15 different from the other backends.
      Fortunately, it seems, the only thing that is currently broken due to this issue is static inline functions.

      Philipp

       
    • Philipp Klaus Krause

      They can't be initialized to data, since data is not a constant expression. So pdk, like the other ports, instead sets them to data in finaliseOptions (and I checked that that function does get called).

       
  • Philipp Klaus Krause

    Apparently, this issue affects parameters of static inline functions only.

    P.S.: It looks like these parameters for pdk have sclass S_XDATA, while for mcs51 and hc08 they have sclass S_FIXED when defaultOClass is called for them. And pdk doesn't even have xdata (unlike hc08 and mcs51).

     

    Last edit: Philipp Klaus Krause 2023-05-10
  • Philipp Klaus Krause

    • assigned_to: Philipp Klaus Krause
     
  • Philipp Klaus Krause

    • status: open --> closed-fixed
     
  • Philipp Klaus Krause

    Fixed in [r14044].

    The problem was in SDCCmem.c: The logic handling parameters of inline functions there assumed that all ports are --stack-auto by default or have multiple memory models. This is not true for pdk (and maybe not for pic either, but pic is too broken for me to check if it is affected by the issue).

     

    Related

    Commit: [r14044]


    Last edit: Philipp Klaus Krause 2023-05-10

Log in to post a comment.