public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/112679] New: ICE in expand_float, at optabs.cc:5724 with bitint
@ 2023-11-23 12:58 mjires at suse dot cz
  2023-11-23 16:35 ` [Bug middle-end/112679] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mjires at suse dot cz @ 2023-11-23 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112679
           Summary: ICE in expand_float, at optabs.cc:5724 with bitint
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mjires at suse dot cz
                CC: jakub at redhat dot com
  Target Milestone: ---

Compiling testsuite/gcc.dg/bitint-35.c
ICE since initial commits - r14-3751-g8c984a1c3693df.


$ gcc bitint-35.c -frounding-math
bitint-35.c: In function ‘foo’:
bitint-35.c:12:19: warning: overflow in conversion from ‘_BitInt(30)’ to
‘_BitInt(27)’ changes value from ‘-390288573’ to ‘12364611’ [-Woverflow]
   12 |   _BitInt(27) d = -390288573wb;                         /* { dg-warning
"overflow in conversion from '_BitInt\\\(30\\\)' to '_BitInt\\\(27\\\)' changes
value from '-390288573' to '12364611'" } */
      |                   ^
bitint-35.c:13:28: warning: conversion from ‘unsigned _BitInt(29)’ to ‘unsigned
_BitInt(27)’ changes value from ‘309641337’ to ‘41205881’ [-Woverflow]
   13 |   unsigned _BitInt(27) e = 309641337uwb;                /* { dg-warning
"conversion from 'unsigned _BitInt\\\(29\\\)' to 'unsigned _BitInt\\\(27\\\)'
changes value from '309641337' to '41205881'" } */
      |                            ^~~~~~~~~~~~
bitint-35.c:16:19: warning: overflow in conversion from ‘int’ to ‘_BitInt(27)’
changes value from ‘-390288573’ to ‘12364611’ [-Woverflow]
   16 |   _BitInt(27) h = -390288573;                           /* { dg-warning
"overflow in conversion from 'int' to '_BitInt\\\(27\\\)' changes value from
'-390288573' to '12364611'" } */
      |                   ^
bitint-35.c:17:28: warning: conversion from ‘unsigned int’ to ‘unsigned
_BitInt(27)’ changes value from ‘309641337’ to ‘41205881’ [-Woverflow]
   17 |   unsigned _BitInt(27) i = 309641337U;                  /* { dg-warning
"conversion from 'unsigned int' to 'unsigned _BitInt\\\(27\\\)' changes value
from '309641337' to '41205881'" } */
      |                            ^~~~~~~~~~
bitint-35.c:20:11: warning: overflow in conversion from ‘_BitInt(64)’ to ‘int’
changes value from ‘-8087431137529383656’ to ‘-1105152744’ [-Woverflow]
   20 |   int l = -8087431137529383656wb;                       /* { dg-warning
"overflow in conversion from '_BitInt\\\(64\\\)' to 'int' changes value from
'-8087431137529383656' to '-1105152744'" } */
      |           ^
bitint-35.c:21:20: warning: conversion from ‘unsigned _BitInt(61)’ to ‘unsigned
int’ changes value from ‘1664073919553255778’ to ‘3338058082’ [-Woverflow]
   21 |   unsigned int m = 1664073919553255778uwb;              /* { dg-warning
"conversion from 'unsigned _BitInt\\\(61\\\)' to 'unsigned int' changes value
from '1664073919553255778' to '3338058082'" } */
      |                    ^~~~~~~~~~~~~~~~~~~~~~
during RTL pass: expand
bitint-35.c:23:12: internal compiler error: in expand_float, at optabs.cc:5729
   23 |   _Float32 n =
51441631083309184313435496923626431699697406185384986811300218556561965470218425783308778801748592322915101142266821623326688106425864884688172114173397118407357447763009120wb;
/* { dg-warning "conversion from '_BitInt\\\(575\\\)' to '_Float32' changes
value from
'0x353eab28b46b03ea99b84f9736cd8dbe5e986915a0383c3cb381c0da41e31b3621c75fd53262bfcb1b0e6251dbf00f3988784e29b08b65640c263e4d0959832a20e2ff5245be1e60'
to '\\\+Inff32'" "" { target bitint575 } } */
      |            ^
0x7e2b67 expand_float(rtx_def*, rtx_def*, int)
        /home/mjires/git/GCC/master/gcc/optabs.cc:5729
0xc06bc8 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        /home/mjires/git/GCC/master/gcc/expr.cc:9945
0xae0440 expand_gimple_stmt_1
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:3983
0xae0440 expand_gimple_stmt
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:4044
0xae65f6 expand_gimple_basic_block
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:6100
0xae7f36 execute
        /home/mjires/git/GCC/master/gcc/cfgexpand.cc:6835
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.


$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/mjires/built/master/libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/mjires/git/GCC/master/configure
--prefix=/home/mjires/built/master --disable-bootstrap --enable-checking
--enable-languages=c,c++,fortran,lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231123 (experimental) (GCC)

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

* [Bug middle-end/112679] ICE in expand_float, at optabs.cc:5724 with bitint
  2023-11-23 12:58 [Bug middle-end/112679] New: ICE in expand_float, at optabs.cc:5724 with bitint mjires at suse dot cz
@ 2023-11-23 16:35 ` jakub at gcc dot gnu.org
  2023-11-24 10:31 ` cvs-commit at gcc dot gnu.org
  2023-11-24 10:44 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-23 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-23
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

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

Untested fix.

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

* [Bug middle-end/112679] ICE in expand_float, at optabs.cc:5724 with bitint
  2023-11-23 12:58 [Bug middle-end/112679] New: ICE in expand_float, at optabs.cc:5724 with bitint mjires at suse dot cz
  2023-11-23 16:35 ` [Bug middle-end/112679] " jakub at gcc dot gnu.org
@ 2023-11-24 10:31 ` cvs-commit at gcc dot gnu.org
  2023-11-24 10:44 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-24 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS 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:31669ec1d01c93fb0a63a7053ad314c17fa5a416

commit r14-5818-g31669ec1d01c93fb0a63a7053ad314c17fa5a416
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Nov 24 11:30:30 2023 +0100

    lower-bitint: Lower FLOAT_EXPR from BITINT_TYPE INTEGER_CST [PR112679]

    The bitint lowering pass only does something if it sees BITINT_TYPE
(medium,
    large, huge) SSA_NAMEs.  In the past I've already ran into one special case
    where the above doesn't work well, if there is a store of medium/large/huge
    BITINT_TYPE INTEGER_CST into memory, there might not be any BITINT_TYPE
    SSA_NAMEs in the function, yet we need to lower.  This has been solved by
    also checking for SSA_NAME_IS_VIRTUAL_OPERAND if at the vdef there isn't
    such a store (the whole intent is make the pass as cheap as possible in the
    currently very likely case that the IL doesn't have any BITINT_TYPEs at
    all).
    And the following testcase shows a similar problem.  With -frounding-math
    we don't fold some of FLOAT_EXPRs with INTEGER_CST operands, and if those
    INTEGER_CSTs are medium/large/huge BITINT_TYPEs, we need to either cast
    the INTEGER_CST to corresponding INTEGER_TYPE (for medium) or lower to
    internal fn call which is later turned into libgcc call (for large/huge).
    The following patch does that, but of course admittedly this discovery
    of stores and FLOAT_EXPRs means we already look through quite a few
    SSA_NAME_DEF_STMTs even when BITINT_TYPEs never appear.

    2023-11-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/112679
            * gimple-lower-bitint.cc (gimple_lower_bitint): Also stop first
loop on
            floating point SSA_NAME set in FLOAT_EXPR assignment from
BITINT_TYPE
            INTEGER_CST.  Set has_large_huge for those if that BITINT_TYPE is
large
            or huge.  Set kind to such FLOAT_EXPR assignment rhs1 BITINT_TYPE's
kind.

            * gcc.dg/bitint-42.c: New test.

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

* [Bug middle-end/112679] ICE in expand_float, at optabs.cc:5724 with bitint
  2023-11-23 12:58 [Bug middle-end/112679] New: ICE in expand_float, at optabs.cc:5724 with bitint mjires at suse dot cz
  2023-11-23 16:35 ` [Bug middle-end/112679] " jakub at gcc dot gnu.org
  2023-11-24 10:31 ` cvs-commit at gcc dot gnu.org
@ 2023-11-24 10:44 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-24 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.

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

end of thread, other threads:[~2023-11-24 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 12:58 [Bug middle-end/112679] New: ICE in expand_float, at optabs.cc:5724 with bitint mjires at suse dot cz
2023-11-23 16:35 ` [Bug middle-end/112679] " jakub at gcc dot gnu.org
2023-11-24 10:31 ` cvs-commit at gcc dot gnu.org
2023-11-24 10:44 ` 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).