Bug 104705 - [12 regression] ICE ‘global_options’ are modified in local context in cl_optimization_compare
Summary: [12 regression] ICE ‘global_options’ are modified in local context in cl_opti...
Status: RESOLVED DUPLICATE of bug 104381
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Martin Liška
URL:
Keywords: ice-on-valid-code, needs-bisection
Depends on:
Blocks:
 
Reported: 2022-02-26 20:59 UTC by Sergei Trofimovich
Modified: 2022-02-28 09:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2022-02-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich 2022-02-26 20:59:19 UTC
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)
Comment 1 Andrew Pinski 2022-02-26 21:03:24 UTC
Interesting it does not ICE with -g.
Comment 2 Martin Liška 2022-02-27 09:27:46 UTC
Mine.
Comment 3 Martin Liška 2022-02-28 09:17:32 UTC
The root cause is the same as PR104381.

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