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 tree-optimization/110743] Unexpected -ftrivial-auto-var-init=pattern behavior with partial bitfields Date: Thu, 20 Jul 2023 09:57:07 +0000 [thread overview] Message-ID: <bug-110743-4-Sf94eUfn40@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110743-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110743 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 CC| |jakub at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2023-07-20 Blocks| |24639 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- We interestingly see <bb 2> : op = .DEFERRED_INIT (24, 1, &"op"[0]); _1 = MEM <long int> [(struct spi_mem_op *)&op]; _2 = _1 & 1; MEM <long int> [(struct spi_mem_op *)&op] = _2; _3 = MEM <long int> [(struct spi_mem_op *)&op + 8B]; _4 = _3 & 1; MEM <long int> [(struct spi_mem_op *)&op + 8B] = _4; spi_nor_read_any_reg (&op); op ={v} {CLOBBER(eol)}; return; which is done by __builtin_clear_padding which we insert during gimplification: void s25fs256t_post_bfpt_fixup_nor () { struct spi_mem_op op; try { op = .DEFERRED_INIT (24, 1, &"op"[0]); __builtin_clear_padding (&op, 1B); spi_nor_read_any_reg (&op); } finally { op = {CLOBBER(eol)}; } } I'm not sure why we do it this way. I wonder why we don't diagnose this at -O0. Note RTL expansion of .DEFERRED_INIT _does_ write to the bitfield padding so maybe we can avoid doing that in __builtin_clear_padding (with an extra op?). Confirmed. A workaround is to explicitely name the padding thus add int padding : 31, etc. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639 [Bug 24639] [meta-bug] bug to track all Wuninitialized issues
prev parent reply other threads:[~2023-07-20 9:57 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-19 15:59 [Bug c/110743] New: " arnd at linaro dot org 2023-07-20 9:57 ` rguenth at gcc dot gnu.org [this message]
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-110743-4-Sf94eUfn40@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).