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

            Bug ID: 89998
           Summary: [9 regression] AVR ICE: verify_gimple failed in
                    printf-return-value
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gandalf at winds dot org
  Target Milestone: ---

I get an ICE on the following code with GCC 9.0.1 20190407 (experimental)
compiled for AVR. Works in GCC 8.x. If the __flash keyword is taken out before
_str[]=("xx"), then it compiles OK.


unsigned short sprintf(char *str, const char __flash *fmt, ...)
{
  __builtin_va_list args;

  __builtin_va_start(args, fmt);
  __builtin_va_end(args);
  return 0;
}

extern char *s;

int main()
{
  s+=sprintf(s, ({ static const char __flash _str[]=("xx"); _str; }));
}


# avr-gcc -v -O -mmcu=atmega1284p -c test3.c -o test3.o
Using built-in specs.
Reading specs from
/usr/local/avr/lib/gcc/avr/9.0.1/device-specs/specs-atmega1284p
COLLECT_GCC=avr-gcc
Target: avr
Configured with: ../configure --target=avr --prefix=/usr/local/avr
--disable-nls --enable-languages=c --disable-bootstrap --disable-libssp
Thread model: single
gcc version 9.0.1 20190407 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-O'  '-c' '-o' 'test3.o'
'-specs=device-specs/specs-atmega1284p' '-mmcu=avr51'
 /usr/local/avr/libexec/gcc/avr/9.0.1/cc1 -quiet -v -imultilib avr51
-D__AVR_ATmega1284P__ -D__AVR_DEVICE_NAME__=atmega1284p test3.c -mn-flash=2
-mno-skip-bug -quiet -dumpbase test3.c -mmcu=avr51 -auxbase-strip test3.o -O
-version -o /tmp/ccm4oBir.s
GNU C17 (GCC) version 9.0.1 20190407 (experimental) (avr)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2,
MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/usr/local/avr/lib/gcc/avr/9.0.1/../../../../avr/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/avr/lib/gcc/avr/9.0.1/include
 /usr/local/avr/lib/gcc/avr/9.0.1/include-fixed
 /usr/local/avr/lib/gcc/avr/9.0.1/../../../../avr/include
End of search list.
GNU C17 (GCC) version 9.0.1 20190407 (experimental) (avr)
        compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2,
MPC version 1.1.0, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 082ea327cdf9723cb24010e987b4f891
test3.c: In function 'main':
test3.c:12:5: error: non-trivial conversion at assignment
   12 | int main()
      |     ^~~~
short unsigned int
int
_6 = 2;
during GIMPLE pass: printf-return-value
test3.c:12:5: internal compiler error: verify_gimple failed
0xc51c8b verify_gimple_in_cfg(function*, bool)
        ../../gcc/tree-cfg.c:5386
0xb5ff2f execute_function_todo
        ../../gcc/passes.c:1977
0xb60e6e execute_todo
        ../../gcc/passes.c:2031
Please submit a full bug report.

Reply via email to