public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103899] [12 Regression] make profiledbootstrap fails due to uninitialized warning in expr.c
Date: Wed, 05 Jan 2022 13:55:54 +0000	[thread overview]
Message-ID: <bug-103899-4-bAqZdB3hZh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103899-4@http.gcc.gnu.org/bugzilla/>

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

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

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
While we should fix uninit warning to deal with this if possible, I think we
should also try to work around this in expr.c.

If following works, then I think it would be even a cleanup (as it moves the
context variable declaration to the sole spot where it is used):

--- gcc/expr.c.jj       2022-01-03 10:40:41.203164211 +0100
+++ gcc/expr.c  2022-01-05 14:47:47.684660031 +0100
@@ -10340,7 +10340,6 @@ expand_expr_real_1 (tree exp, rtx target
   enum tree_code code = TREE_CODE (exp);
   rtx subtarget, original_target;
   int ignore;
-  tree context;
   bool reduce_bit_field;
   location_t loc = EXPR_LOCATION (exp);
   struct separate_ops ops;
@@ -10579,14 +10578,16 @@ expand_expr_real_1 (tree exp, rtx target
       /* Variables inherited from containing functions should have
         been lowered by this point.  */
       if (exp)
-       context = decl_function_context (exp);
-      gcc_assert (!exp
-                 || SCOPE_FILE_SCOPE_P (context)
-                 || context == current_function_decl
-                 || TREE_STATIC (exp)
-                 || DECL_EXTERNAL (exp)
-                 /* ??? C++ creates functions that are not TREE_STATIC.  */
-                 || TREE_CODE (exp) == FUNCTION_DECL);
+       {
+         tree context = decl_function_context (exp);
+         gcc_assert (SCOPE_FILE_SCOPE_P (context)
+                     || context == current_function_decl
+                     || TREE_STATIC (exp)
+                     || DECL_EXTERNAL (exp)
+                     /* ??? C++ creates functions that are not
+                        TREE_STATIC.  */
+                     || TREE_CODE (exp) == FUNCTION_DECL);
+       }

       /* This is the case of an array whose size is to be determined
         from its initializer, while the initializer is still being parsed.

  parent reply	other threads:[~2022-01-05 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04  5:50 [Bug bootstrap/103899] New: " pinskia at gcc dot gnu.org
2022-01-04  6:01 ` [Bug bootstrap/103899] " pinskia at gcc dot gnu.org
2022-01-04  6:05 ` pinskia at gcc dot gnu.org
2022-01-04  6:44 ` pinskia at gcc dot gnu.org
2022-01-05  8:17 ` [Bug tree-optimization/103899] [12 Regression] " pinskia at gcc dot gnu.org
2022-01-05  8:25 ` marxin at gcc dot gnu.org
2022-01-05 13:55 ` jakub at gcc dot gnu.org [this message]
2022-01-05 14:06 ` jakub at gcc dot gnu.org
2022-01-05 21:28 ` pinskia at gcc dot gnu.org
2022-01-06 14:33 ` cvs-commit at gcc dot gnu.org
2022-01-06 14:46 ` jakub at gcc dot gnu.org
2022-01-18 13:56 ` rguenth 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-103899-4-bAqZdB3hZh@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).