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 c/47409] volatile struct member bug Date: Wed, 06 Feb 2013 11:47:00 -0000 [thread overview] Message-ID: <bug-47409-4-EscFV3JYuA@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-47409-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47409 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-06 11:47:05 UTC --- I guess we could e.g. handle this in c_gimplify_expr, but the question is what the exact semantics should it have. Testcase: struct S { int a; volatile int b; long c; volatile char d[10]; char e[10]; }; struct S a, b; volatile struct S c, d; union U { int a; volatile char b[10]; volatile long c[5]; }; union U e, f; volatile union U g, h; struct T { int a; volatile int b; union U c; volatile union U d; }; struct T i, j; volatile struct T k, l; struct V { int a : 5; volatile int b : 7; volatile int c : 1; int d; volatile long e : 5; long f : 6; volatile long g : 1; long h : 1; }; struct V m, n; volatile struct V o, p; void f1 () { a = b; } void f2 () { c = b; } void f3 () { a = d; } void f4 () { c = d; } void f5 () { e = f; } void f6 () { g = f; } void f7 () { e = h; } void f8 () { g = h; } void f9 () { i = j; } void f10 () { k = j; } void f11 () { i = l; } void f12 () { k = l; } void f13 () { m = n; } void f14 () { o = n; } void f15 () { m = p; } void f16 () { o = p; } I guess for struct S, it could gimplify it for f1 to: a.a = b.a; a.b = b.b; a.c = b.c; for (temp = 0; temp < 10; temp++) a.d[i] = b.d[i]; a.e = b.e; // aggregate assignment and for f2, f3 and f4 the same, except that instead of the aggregate assignment at the end it would emit a loop similar to d field. But, what to do about unions? The standard says that only one union member is active, but which one it is? I think the compiler generally can't know. So, do we just ignore unions and expand them always as we used to? Pick up the first union member (or randomly or preferrably one with volatile)? What about bitfields? Does it have to be per bitfield assignment, or can we e.g. assign the whole representative field at a time? What are other compilers doing here? I've tried clang 3.1, and don't see it would consider any of the volatile keywords here in any way.
next prev parent reply other threads:[~2013-02-06 11:47 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-01-22 4:13 [Bug c/47409] New: " regehr at cs dot utah.edu 2011-01-22 5:08 ` [Bug c/47409] " regehr at cs dot utah.edu 2011-01-24 16:47 ` jakub at gcc dot gnu.org 2011-01-24 16:53 ` regehr at cs dot utah.edu 2011-01-24 16:57 ` jakub at gcc dot gnu.org 2011-01-25 2:17 ` joseph at codesourcery dot com 2011-01-25 11:11 ` rguenth at gcc dot gnu.org 2011-01-25 16:24 ` regehr at cs dot utah.edu 2011-01-25 17:28 ` joseph at codesourcery dot com 2013-01-30 4:36 ` regehr at cs dot utah.edu 2013-01-30 11:39 ` rguenth at gcc dot gnu.org 2013-01-30 11:44 ` jakub at gcc dot gnu.org 2013-01-30 23:24 ` regehr at cs dot utah.edu 2013-02-06 11:47 ` jakub at gcc dot gnu.org [this message] 2013-02-06 15:00 ` jason at gcc dot gnu.org 2013-02-07 1:42 ` joseph at codesourcery dot com 2013-07-09 8:48 ` francesco.zappa.nardelli at gmail dot com 2013-09-13 9:38 ` rguenth at gcc dot gnu.org 2013-09-13 9:52 ` rguenth at gcc dot gnu.org 2013-09-13 10:38 ` francesco.zappa.nardelli at gmail dot com 2013-09-13 11:51 ` rguenth at gcc dot gnu.org 2013-09-13 14:46 ` francesco.zappa.nardelli at gmail dot com 2014-02-16 13:13 ` jackie.rosen at hushmail dot com 2021-08-05 23:52 ` pinskia at gcc dot gnu.org 2022-07-17 21:00 ` pinskia at gcc dot gnu.org 2024-01-18 6:02 ` pinskia 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-47409-4-EscFV3JYuA@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).