public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/102633] [11/12 Regression] warning for self-initialization despite -Wno-init-self Date: Fri, 10 Feb 2023 17:47:24 +0000 [thread overview] Message-ID: <bug-102633-4-2OZlN1iaxP@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-102633-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102633 --- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:aabebf76e9d9a805ea5b443d4ee4f49f13155d87 commit r12-9160-gaabebf76e9d9a805ea5b443d4ee4f49f13155d87 Author: Marek Polacek <polacek@redhat.com> Date: Tue Jul 26 13:55:58 2022 -0400 c-family: Honor -Wno-init-self for cv-qual vars [PR102633] Since r11-5188-g32934a4f45a721, we drop qualifiers during l-to-r conversion by creating a NOP_EXPR. For e.g. const int i = i; that means that the DECL_INITIAL is '(int) i' and not 'i' anymore. Consequently, we don't suppress_warning here: 711 case DECL_EXPR: 715 if (VAR_P (DECL_EXPR_DECL (*expr_p)) 716 && !DECL_EXTERNAL (DECL_EXPR_DECL (*expr_p)) 717 && !TREE_STATIC (DECL_EXPR_DECL (*expr_p)) 718 && (DECL_INITIAL (DECL_EXPR_DECL (*expr_p)) == DECL_EXPR_DECL (*expr_p)) 719 && !warn_init_self) 720 suppress_warning (DECL_EXPR_DECL (*expr_p), OPT_Winit_self); because of the check on line 718 -- (int) i is not i. So -Wno-init-self doesn't disable the warning as it's supposed to. The following patch fixes it by moving the suppress_warning call from c_gimplify_expr to the front ends, at points where we haven't created the NOP_EXPR yet. PR middle-end/102633 gcc/c-family/ChangeLog: * c-gimplify.cc (c_gimplify_expr) <case DECL_EXPR>: Don't call suppress_warning here. gcc/c/ChangeLog: * c-parser.cc (c_parser_initializer): Add new tree parameter. Use it. Call suppress_warning. (c_parser_declaration_or_fndef): Pass d down to c_parser_initializer. (c_parser_omp_declare_reduction): Pass omp_priv down to c_parser_initializer. gcc/cp/ChangeLog: * decl.cc (cp_finish_decl): Call suppress_warning. gcc/testsuite/ChangeLog: * c-c++-common/Winit-self1.c: New test. * c-c++-common/Winit-self2.c: New test. (cherry picked from commit 04ce2400b35225302e0d6883bb0817378180f5d7)
next prev parent reply other threads:[~2023-02-10 17:47 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-10-06 21:40 [Bug middle-end/102633] New: " msebor at gcc dot gnu.org 2021-10-06 21:42 ` [Bug middle-end/102633] [11/12 Regression] " msebor at gcc dot gnu.org 2021-10-06 21:47 ` msebor at gcc dot gnu.org 2021-10-07 9:02 ` rguenth at gcc dot gnu.org 2022-04-21 7:50 ` rguenth at gcc dot gnu.org 2022-07-26 13:25 ` [Bug middle-end/102633] [11/12/13 " rguenth at gcc dot gnu.org 2022-07-26 14:09 ` mpolacek at gcc dot gnu.org 2022-07-26 14:28 ` mpolacek at gcc dot gnu.org 2022-07-27 6:11 ` muecker at gwdg dot de 2022-08-11 14:29 ` cvs-commit at gcc dot gnu.org 2022-08-11 14:30 ` [Bug middle-end/102633] [11/12 " mpolacek at gcc dot gnu.org 2023-02-10 15:16 ` mpolacek at gcc dot gnu.org 2023-02-10 17:47 ` cvs-commit at gcc dot gnu.org [this message] 2023-02-10 17:55 ` jakub at gcc dot gnu.org 2023-02-22 16:10 ` [Bug middle-end/102633] [11 " mpolacek 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-102633-4-2OZlN1iaxP@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: linkBe 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).