Menu

#4013 possibly incorrect use of warning 361

closed-fixed
None
Front-end
5
2 days ago
2026-06-18
No

simple ROM entry definitions like:

__at 0xff81 void(*CINT)(void);

trigger:

warning 361: qualifier on return type has no effect

I am not sure what is sdcc is complaining about. void is not a qualifier and __at 0xff81 seems to work as intended.

Related

Patches: #515

Discussion

  • Philipp Klaus Krause

    From the generated asm, you are declaring a function pointer, which resides at 0xff81. And the following all do the same:

    __at(0xff81) void(*f)(void);
    
     void(*__at(0xff81) g)(void);
    
     typedef void (*ftype)(void);
    
     ftype __at(0xff81) h;
    
     void test(void)
     {
        f();
        g();
        h();
     }
    

    I'm not very familiar with function pointer declarations, but wonder if for the first one, the __at is syntactically on the return type? But we get the same warning for all three declarations.

    Looking at the place where the warning is emitted, it looks like the return type of the function is considered to be volatile-qualified there. I guess that originates from checkSClass in SDCCsymt.c (line 2196f), which adds volatile to anything for which IS_ABSOLUTE holds .

     

    Last edit: Philipp Klaus Krause 2026-06-19
    • Li-Hsin Chien

      Li-Hsin Chien - 4 days ago

      Thanks, the analysis was very helpful.

      I submitted [patches:#515] for review.
      It marks the function pointer itself as volatile instead of the function return type, and adds a regression test based on this ticket. This should also fix [bugs:#4041].

      Please let me know if this makes sense.

       

      Related

      Bugs: #4041
      Patches: #515

  • Maarten Brock

    Maarten Brock - 2 days ago
    • status: open --> closed-fixed
    • assigned_to: Maarten Brock
     

Log in to post a comment.