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/100130] R section flag handling doesn't cope with intervening decls
Date: Wed, 21 Apr 2021 08:08:55 +0000	[thread overview]
Message-ID: <bug-100130-4-epe0MhPUKS@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100130-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Sandiford <rsandifo@gcc.gnu.org>:

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

commit r12-17-gb67778b59932fdc64dc89a97550349e973ca0352
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Apr 21 09:08:44 2021 +0100

    varasm: Two SECTION_RETAIN fixes [PR100130]

    switch_to_section warns if we try to output a retain decl in a
    section without a retain flag, or if we try to output a non-retain
    decl in a section with a retain flag.  However, the warning only
    applied if we were trying to âswitchâ to the current section.
    This works if all decls that use a section are generated consecutively,
    but not if there is an unrelated decl in between.

    This patch makes the check unconditional, but suppresses the warning
    if we're writing the section's named.decl (i.e. the decl from which
    the section name and original flags were derived).

    Also, the warning didn't fire for -fsection-anchors, for two reasons:
    we allowed retain and non-retain decls to be put into the same block,
    and we didn't pass a decl to switch_to_section.

    Although these are arguably separate bugs, it isn't easy to fix them
    independently without temporarily regressing -fsection-anchor targets.

    gcc/
            PR middle-end/100130
            * varasm.c (get_block_for_decl): Make sure that any use of the
            retain attribute matches the section's retain flag.
            (switch_to_section): Check for retain mismatches even when
            changing sections, but do not warn if the given decl is the
            section's named.decl.
            (output_object_block): Pass the first decl in the block (if any)
            to switch_to_section.

    gcc/testsuite/
            PR middle-end/100130
            * c-c++-common/attr-retain-10.c: New test.
            * c-c++-common/attr-retain-11.c: Likewise.

  parent reply	other threads:[~2021-04-21  8:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-17 11:17 [Bug middle-end/100130] New: " rsandifo at gcc dot gnu.org
2021-04-17 11:27 ` [Bug middle-end/100130] " rsandifo at gcc dot gnu.org
2021-04-21  8:08 ` cvs-commit at gcc dot gnu.org [this message]
2021-04-21  8:10 ` rsandifo 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-100130-4-epe0MhPUKS@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).