https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112494
Bug ID: 112494 Summary: GCC: 14: internal compiler error: in ix86_cc_mode, at config/i386/i386.cc:16477 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: 141242068 at smail dot nju.edu.cn Target Milestone: --- Compiler Explorer: https://gcc.godbolt.org/z/cPPxenx7q When compile this program with `-Og -fno-tree-copy-prop -fno-tree-fre -fno-tree-ccp -fno-tree-forwprop`, gcc crashes: ``` #include <x86intrin.h> #ifdef __x86_64__ # define EFLAGS_TYPE unsigned long long int #else # define EFLAGS_TYPE unsigned int #endif int main() { EFLAGS_TYPE flags = 0xD7; __writeeflags(0xD7); flags && !__readeflags(); if ((flags && (!__readeflags())) != 0xD7); return 0; } ``` There are some intriguing observations about this crash. 1. Removing the `flags &&` portion at the point of the first __readeflags() call eliminates the crash, even though it appears that `flags &&` has no effect. 2. Removing the `!= 0xD7` portion at the point of the second __readeflags() call also eliminates the crash. The crash output: ``` during RTL pass: combine <source>: In function 'main': <source>:15:1: internal compiler error: in ix86_cc_mode, at config/i386/i386.cc:16477 15 | } | ^ 0x238b15e internal_error(char const*, ...) ???:0 0xa11270 fancy_abort(char const*, int, char const*) ???:0 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. Compiler returned: 1 ```