Am 15.05.26 um 14:17 schrieb Thomas Schwinge:
[Note that emails to <[email protected]> bounce; please use Paul's
other email address: <[email protected]>.]

Hi!

I'd like to resume this patch submission here, which is adding support
for named address spaces to GNU C++, as is implemented for GNU C.  As far
as I can tell, there wasn't any specific technical reason that this patch
review stalled, back then, in 2022-11?  (Jason?)

I've now rebased this onto recent GCC trunk, see attached
'0001-c-parser-Support-for-target-address-spaces-in-C.patch'.  There were
just a few merge conflicts that I had to fix up (nothing serious), and
I've bootstrap-tested on x86_64-pc-linux-gnu (only, so far).

Hi, I found one more problem on avr:

#define AS1 const __flash
#define AS8 const __memx

typedef int (* AS1 fun_t)();

int foo (AS8 fun_t *f)
{
    return (*f) ();
}

Compiling for C, I am getting a parm_decl like this:

    <parm_decl 0x7fb7668d3000 f>
       <pointer_type 0x7fb7668a77e0>
          <pointer_type 0x7fb7668a7690 fun_t address-space-8> read-only
             <function_type 0x7fb766782690>
                <integer_type 0x7fb76676f5e8 int> return
                <void_type 0x7fb7667771f8 void>

and an error message:

x.c:6:21: error: conflicting named address spaces (__memx vs __flash)
    6 | int foo (AS8 fun_t *f)

With C++ there is AS9 even though the source says AS8:

    <parm_decl 0x7ff87a763088 f>
       <pointer_type 0x7ff87a74cbd0>
          <pointer_type 0x7ff87a74ce70 fun_t address-space-9> read-only
             <function_type 0x7ff87a619930>
                <integer_type 0x7ff87a6055e8 int> return
                <void_type 0x7ff87a60e1f8 void>

and then ICEs as there is no name for AS9:

x.c:6:5: internal compiler error: in c_addr_space_name, at c-family/c-common.cc:659
    6 | int foo (AS8 fun_t *f)
      |     ^~~

Johann



Reply via email to