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

--- Comment #7 from Werner Zeh <werner.zeh at coreboot dot org> ---
Dear gcc maintainers,

recently, we stumbled upon an internal compiler error for the mingw gcc
compiler in version 12.2.0.
The compiler error can be reproduced with the attached example.ii.

There also is a gotbolt link, which demonstrates the behavior:
https://godbolt.org/z/abq19c1dK

The analysis has shown that the observed behavior was introduced with commit
122f9da15d1db58bd5f96a8a49d81d529ca07a1e between version 7 and 8.

Looking deeper into this change, you see the following change made in
gcc/config/i386/i386.c:
1  static inline bool
2  fp_valid_at (HOST_WIDE_INT cfa_offset)
3  {
4  const struct machine_frame_state &fs = cfun->machine->fs;
5  - return fs.fp_valid && !(fs.sp_valid && fs.sp_realigned
6  - && cfa_offset > fs.sp_realigned_offset);
7  + if (fs.sp_realigned && cfa_offset > fs.sp_realigned_fp_last)
8  + {
9  + /* Validate that the cfa_offset isn't in a "no-man's land". */
10 + gcc_assert (cfa_offset >= fs.sp_realigned_offset);
11 + return false;
12 + }
13 + return fs.fp_valid;
14 }

The problem is that this change modified the condition in line 5 to line 7,
which removed the term
fs.sp_valid.

Changing the condition in line 7 and reintroduce the condition fs.sp_valid
would fix the internal
compiler error above.

Reply via email to