public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112494] New: GCC: 14: internal compiler error: in ix86_cc_mode, at config/i386/i386.cc:16477
@ 2023-11-12 14:25 141242068 at smail dot nju.edu.cn
  2023-11-12 20:57 ` [Bug rtl-optimization/112494] " ubizjak at gmail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-11-12 14:25 UTC (permalink / raw)
  To: gcc-bugs

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
```

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

end of thread, other threads:[~2023-11-28 16:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 14:25 [Bug c/112494] New: GCC: 14: internal compiler error: in ix86_cc_mode, at config/i386/i386.cc:16477 141242068 at smail dot nju.edu.cn
2023-11-12 20:57 ` [Bug rtl-optimization/112494] " ubizjak at gmail dot com
2023-11-12 21:12 ` [Bug rtl-optimization/112494] ICE " pinskia at gcc dot gnu.org
2023-11-13  7:57 ` pinskia at gcc dot gnu.org
2023-11-13  8:50 ` ubizjak at gmail dot com
2023-11-13  8:52 ` [Bug target/112494] " ubizjak at gmail dot com
2023-11-13  9:54 ` ubizjak at gmail dot com
2023-11-13  9:59 ` ubizjak at gmail dot com
2023-11-13 10:51 ` ubizjak at gmail dot com
2023-11-13 21:47 ` cvs-commit at gcc dot gnu.org
2023-11-28 15:57 ` cvs-commit at gcc dot gnu.org
2023-11-28 16:00 ` ubizjak at gmail dot com

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).