public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000
@ 2023-12-06 19:31 zsojka at seznam dot cz
  2023-12-06 19:53 ` [Bug tree-optimization/112887] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2023-12-06 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112887
           Summary: during GIMPLE pass: phiopt ICE: Floating point
                    exception (SIGFPE) at tree-ssa-phiopt.c:2224 with
                    --param=l1-cache-line-size=0x20000000
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 56819
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56819&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O2 --param=l1-cache-line-size=0x20000000 testcase.c
testcase.c: In function 'foo':
testcase.c:11:1: internal compiler error: Floating point exception
 foo (void)
 ^~~
0xb8d28f crash_signal
        /repo/gcc-6-branch/gcc/toplev.c:333
0xd0df7b hoist_adjacent_loads
        /repo/gcc-6-branch/gcc/tree-ssa-phiopt.c:2224
0xd0ec46 tree_ssa_phiopt_worker
        /repo/gcc-6-branch/gcc/tree-ssa-phiopt.c:251
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

There is a division by zero, since param_align_bits == 0:

...
  int param_align = param_l1_cache_line_size;
  unsigned param_align_bits = (unsigned) (param_align * BITS_PER_UNIT);
...

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

* [Bug tree-optimization/112887] during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000
  2023-12-06 19:31 [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000 zsojka at seznam dot cz
@ 2023-12-06 19:53 ` pinskia at gcc dot gnu.org
  2023-12-07  8:16 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-06 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
param_l1_cache_line_size should most likely limited to a max of 128MB .

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

* [Bug tree-optimization/112887] during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000
  2023-12-06 19:31 [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000 zsojka at seznam dot cz
  2023-12-06 19:53 ` [Bug tree-optimization/112887] " pinskia at gcc dot gnu.org
@ 2023-12-07  8:16 ` rguenth at gcc dot gnu.org
  2023-12-08 15:34 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-12-07  8:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-12-07
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Some limit would be reasonable, but phiopt could be a bit more defensive as
well here.

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

* [Bug tree-optimization/112887] during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000
  2023-12-06 19:31 [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000 zsojka at seznam dot cz
  2023-12-06 19:53 ` [Bug tree-optimization/112887] " pinskia at gcc dot gnu.org
  2023-12-07  8:16 ` rguenth at gcc dot gnu.org
@ 2023-12-08 15:34 ` jakub at gcc dot gnu.org
  2023-12-09 20:41 ` cvs-commit at gcc dot gnu.org
  2023-12-09 20:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-08 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56835
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56835&action=edit
gcc14-pr112887.patch

The function uses tree_fits_uhwi_p and then just blindly sets int vars to
tree_to_uhwi.
I think we just should use unsigned HOST_WIDE_INT types everywhere, that fixes
the ICE too.

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

* [Bug tree-optimization/112887] during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000
  2023-12-06 19:31 [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000 zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2023-12-08 15:34 ` jakub at gcc dot gnu.org
@ 2023-12-09 20:41 ` cvs-commit at gcc dot gnu.org
  2023-12-09 20:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-09 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c250ff90989a71dff11e9256e99d2fa965ab1295

commit r14-6360-gc250ff90989a71dff11e9256e99d2fa965ab1295
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Dec 9 21:41:00 2023 +0100

    phiopt: Fix ICE with large --param l1-cache-line-size= [PR112887]

    This function is never called when param_l1_cache_line_size is 0,
    but it uses int and unsigned int variables to hold alignment in
    bits, so for large param_l1_cache_line_size it is zero and e.g.
    DECL_ALIGN () % param_align_bits can divide by zero.
    Looking at the code, the function uses tree_fits_uhwi_p on the trees
    before converting them using tree_to_uhwi to int variables, which
    looks just wrong, either it would need to punt if it doesn't fit
    into those and also check for overflows during the computation,
    or use unsigned HOST_WIDE_INT for all of this.  That also fixes
    the division by zero, as param_l1_cache_line_size maximum is INT_MAX,
    that multiplied by 8 will always fit.

    2023-12-09  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/112887
            * tree-ssa-phiopt.cc (hoist_adjacent_loads): Change type of
            param_align, param_align_bits, offset1, offset2, size2 and align1
            variables from int or unsigned int to unsigned HOST_WIDE_INT.

            * gcc.dg/pr112887.c: New test.

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

* [Bug tree-optimization/112887] during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000
  2023-12-06 19:31 [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000 zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2023-12-09 20:41 ` cvs-commit at gcc dot gnu.org
@ 2023-12-09 20:42 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-09 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2023-12-09 20:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-06 19:31 [Bug tree-optimization/112887] New: during GIMPLE pass: phiopt ICE: Floating point exception (SIGFPE) at tree-ssa-phiopt.c:2224 with --param=l1-cache-line-size=0x20000000 zsojka at seznam dot cz
2023-12-06 19:53 ` [Bug tree-optimization/112887] " pinskia at gcc dot gnu.org
2023-12-07  8:16 ` rguenth at gcc dot gnu.org
2023-12-08 15:34 ` jakub at gcc dot gnu.org
2023-12-09 20:41 ` cvs-commit at gcc dot gnu.org
2023-12-09 20:42 ` jakub at gcc dot gnu.org

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