public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/103031] [12 Regression] Missing static initializer folding with -frounding-math
Date: Tue, 02 Nov 2021 07:43:27 +0000	[thread overview]
Message-ID: <bug-103031-4-g5l3d3HmzJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103031-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-02
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |12.0
     Ever confirmed|0                           |1
          Component|middle-end                  |c

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I suppose the frontend is calling fold_convert directly rather than
fold_build1_initializer (FLOAT_EXPR, ...).

The frontend ends up building this via

#0  0x0000000000d53d87 in convert_to_real_1 (
    type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>, 
    fold_p=true) at /home/rguenther/src/gcc3/gcc/convert.c:319
#1  0x0000000000d53f0a in convert_to_real (
    type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>)
    at /home/rguenther/src/gcc3/gcc/convert.c:347
#2  0x0000000000b3cb90 in convert (type=<real_type 0x7ffff6566348 double>, 
    expr=<integer_cst 0x7ffff6544540>)
    at /home/rguenther/src/gcc3/gcc/c/c-convert.c:138
#3  0x0000000000b9f602 in convert_and_check (loc=242464, 
    type=<real_type 0x7ffff6566348 double>, expr=<integer_cst 0x7ffff6544540>)
    at /home/rguenther/src/gcc3/gcc/c-family/c-common.c:1767
#4  0x0000000000b1055e in convert_for_assignment (location=242464, expr_loc=0, 
    type=<real_type 0x7ffff6566348 double>, rhs=<integer_cst 0x7ffff6544540>, 
    origtype=<tree 0x0>, errtype=ic_init, null_pointer_constant=false, 
    fundecl=<tree 0x0>, function=<tree 0x0>, parmnum=0, warnopt=0)
    at /home/rguenther/src/gcc3/gcc/c/c-typeck.c:7032
#5  0x0000000000b18c6e in digest_init (init_loc=242464, 
    type=<real_type 0x7ffff6566348 double>, init=<integer_cst 0x7ffff6544540>, 
    origtype=<tree 0x0>, null_pointer_constant=false, strict_string=true, 
    require_constant=1) at /home/rguenther/src/gcc3/gcc/c/c-typeck.c:8217
#6  0x0000000000b16df8 in store_init_value (init_loc=242464, 
    decl=<var_decl 0x7ffff7ff5c60 x>, init=<integer_cst 0x7ffff6544540>, 
--Type <RET> for more, q to quit, c to continue without paging--
    origtype=<tree 0x0>) at /home/rguenther/src/gcc3/gcc/c/c-typeck.c:7762
#7  0x0000000000ace0e7 in finish_decl (decl=<var_decl 0x7ffff7ff5c60 x>, 
    init_loc=242464, init=<integer_cst 0x7ffff6544540>, origtype=<tree 0x0>, 
    asmspec_tree=<tree 0x0>) at /home/rguenther/src/gcc3/gcc/c/c-decl.c:5363

maybe convert_for_assignment needs to do something similar as
START/END_FOLD_INIT around the convert_and_check or convert_for_assignment
is not the correct thing to call here.  It's also odd that convert_to_real
says fold_p == true to convert_to_real_1 but that function doesn't actually
fold anything (maybe that's just all dead code).  I'm quite sure that
initializer_constant_valid_p isn't the one that has to accept a FLOAT_EXPR
here.

C frontend maintainers need to sort this out.

  parent reply	other threads:[~2021-11-02  7:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 20:44 [Bug middle-end/103031] New: " jsm28 at gcc dot gnu.org
2021-11-01 20:47 ` [Bug middle-end/103031] " pinskia at gcc dot gnu.org
2021-11-02  7:43 ` rguenth at gcc dot gnu.org [this message]
2021-11-03 15:00 ` [Bug c/103031] " cvs-commit at gcc dot gnu.org
2021-11-03 15:01 ` jsm28 at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103031-4-g5l3d3HmzJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).