public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112866] New: error: compound literal qualified by address-space qualifier
@ 2023-12-05 14:20 gjl at gcc dot gnu.org
  2023-12-05 14:23 ` [Bug c/112866] " gjl at gcc dot gnu.org
  2023-12-05 18:34 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-12-05 14:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112866

            Bug ID: 112866
           Summary: error: compound literal qualified by address-space
                    qualifier
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Suppose we want to define an array of pointers to some address-space, like in:

#define FSTR(X) ((const __flash char[]) { X })

const __flash char *p[] = { FSTR("cat"), FSTR("dogs") }; // OK

This works as expected, but not when done in a function:


#define FSTR(X) ((const __flash char[]) { X })

const __flash char *p[] = { FSTR("cat"), FSTR("dogs") }; // OK

void func (void)
{
    static const __flash char *q1[] = { FSTR("cat"), FSTR("dogs") }; // Error
    const __flash char *q2[] = { FSTR("cat"), FSTR("dogs") }; // Error
}

addr-space.c: In function 'func':
addr-space.c:7:5: error: compound literal qualified by address-space qualifier
    7 |     static const __flash char *q1[] = { FSTR("cat"), FSTR("dogs") }; //
Error
      |     ^~~~~~
addr-space.c:7:5: error: compound literal qualified by address-space qualifier
addr-space.c:8:5: error: compound literal qualified by address-space qualifier
    8 |     const __flash char *q2[] = { FSTR("cat"), FSTR("dogs") }; // Error
      |     ^~~~~
addr-space.c:8:5: error: compound literal qualified by address-space qualifier

Compile with avr-gcc addr-space.c -S

Target: avr
Configured with: ../../source/gcc-master/configure --target=avr --disable-nls
--with-dwarf2 --with-gnu-as --with-gnu-ld --disable-shared
--enable-checking=release --enable-languages=c,c++ 
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20231205 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/112866] error: compound literal qualified by address-space qualifier
  2023-12-05 14:20 [Bug c/112866] New: error: compound literal qualified by address-space qualifier gjl at gcc dot gnu.org
@ 2023-12-05 14:23 ` gjl at gcc dot gnu.org
  2023-12-05 18:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: gjl at gcc dot gnu.org @ 2023-12-05 14:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112866

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Occurs with all versions that support address-spaces (v4.7 and up).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/112866] error: compound literal qualified by address-space qualifier
  2023-12-05 14:20 [Bug c/112866] New: error: compound literal qualified by address-space qualifier gjl at gcc dot gnu.org
  2023-12-05 14:23 ` [Bug c/112866] " gjl at gcc dot gnu.org
@ 2023-12-05 18:34 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-05 18:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112866

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 84163 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-05 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-05 14:20 [Bug c/112866] New: error: compound literal qualified by address-space qualifier gjl at gcc dot gnu.org
2023-12-05 14:23 ` [Bug c/112866] " gjl at gcc dot gnu.org
2023-12-05 18:34 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).