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

            Bug ID: 104705
           Summary: [12 regression] ICE ‘global_options’ are modified in
                    local context in cl_optimization_compare
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
                CC: mliska at suse dot cz
  Target Milestone: ---

Tried to build ghc-HEAD with gcc-master today, got an ICE on pragmas in
intrisics.

Here is a small reproducer (I think I lost real "optimize" value during
shrinking, does it matter much for this ICE?):

    //$ cat a.c
    #pragma GCC optimize "foo"
    #pragma GCC push_options
    #pragma GCC pop_options

$ /tmp/bg/gcc/xgcc -B/tmp/bg/gcc -c a.c  -O2 -Wall
a.c:1:9: warning: bad option ‘-ffoo’ to pragma ‘optimize’ [-Wpragmas]
    1 | #pragma GCC optimize "foo"
      |         ^~~
a.c:3:9: internal compiler error: ‘global_options’ are modified in local
context
    3 | #pragma GCC pop_options
      |         ^~~
0xccf111 cl_optimization_compare(gcc_options*, gcc_options*)
        /tmp/bg/gcc/options-save.cc:15919
0x7ca26f handle_pragma_pop_options
        /home/slyfox/dev/git/gcc/gcc/c-family/c-pragma.cc:1141
0x7cd42e c_invoke_pragma_handler(unsigned int)
        /home/slyfox/dev/git/gcc/gcc/c-family/c-pragma.cc:1569
0x72a4ca c_parser_pragma
        /home/slyfox/dev/git/gcc/gcc/c/c-parser.cc:12621
0x7555e7 c_parser_external_declaration
        /home/slyfox/dev/git/gcc/gcc/c/c-parser.cc:1760
0x75596a c_parser_translation_unit
        /home/slyfox/dev/git/gcc/gcc/c/c-parser.cc:1652
0x75596a c_parse_file()
        /home/slyfox/dev/git/gcc/gcc/c/c-parser.cc:23357
0x7c7e81 c_common_parse_file()
        /home/slyfox/dev/git/gcc/gcc/c-family/c-opts.cc:1238
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ /tmp/bg/gcc/xgcc -B/tmp/bg/gcc -v
Reading specs from /tmp/bg/gcc/specs
COLLECT_GCC=/tmp/bg/gcc/xgcc
COLLECT_LTO_WRAPPER=/tmp/bg/gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap
--with-native-system-header-dir=/<<NIX>>/glibc-2.33-108-dev/include
--prefix=/tmp/bg/__td__ CFLAGS='-O1 -ggdb3' CXXFLAGS='-O1 -ggdb3' LDFLAGS='-O1
-ggdb3'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.1 20220226 (experimental) (GCC)

Reply via email to