public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/33053]  New: adopt accesses through a volatile-casted pointer as a GNU C extension
@ 2007-08-12  9:50 segher at kernel dot crashing dot org
  2007-08-18 14:10 ` [Bug c/33053] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 6+ messages in thread
From: segher at kernel dot crashing dot org @ 2007-08-12  9:50 UTC (permalink / raw)
  To: gcc-bugs

...with the semantics that such accesses should work as-if the underlying
object
had a volatile-qualified type.

Some GCC users (notably the Linux kernel) already depend on this behaviour;
however since GCC never actually supported it their expectations keep breaking
(see for example PR21568, PR22278, PR29753).

I am not requesting that GCC implement any other semantics that people
expect from volatile; only that GCC treat


int x;
... *(volatile int *)&x ...;


as if it read


volatile int x;
... x ...;


===

Please consider,


Segher


-- 
           Summary: adopt accesses through a volatile-casted pointer as a
                    GNU C extension
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: segher at kernel dot crashing dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33053


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/33053] adopt accesses through a volatile-casted pointer as a GNU C extension
  2007-08-12  9:50 [Bug c/33053] New: adopt accesses through a volatile-casted pointer as a GNU C extension segher at kernel dot crashing dot org
@ 2007-08-18 14:10 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-08-18 14:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-08-18 14:10 -------
defacto this is already (undocumented) GCC behavior.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33053


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/33053] adopt accesses through a volatile-casted pointer as a GNU C extension
       [not found] <bug-33053-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-01-05 10:45 ` daniel.lundin.mail at gmail dot com
@ 2023-01-05 11:22 ` segher at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: segher at gcc dot gnu.org @ 2023-01-05 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Daniel Lundin from comment #5)
> This ought to result in stricter optimizing behavior from gcc, not the other
> way around.

Well, GCC did implement this already.  My request was that we should document
this, so that users can depend on this.

> As reported in bug 108298
> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108298), gcc 11 and beyond
> rather seems to optimize more aggressively, which it didn't up to version
> 10.4.

And that is a bug.  I'll reopen that PR.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/33053] adopt accesses through a volatile-casted pointer as a GNU C extension
       [not found] <bug-33053-4@http.gcc.gnu.org/bugzilla/>
  2022-03-18 14:58 ` segher at gcc dot gnu.org
  2023-01-05  9:18 ` pinskia at gcc dot gnu.org
@ 2023-01-05 10:45 ` daniel.lundin.mail at gmail dot com
  2023-01-05 11:22 ` segher at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: daniel.lundin.mail at gmail dot com @ 2023-01-05 10:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Daniel Lundin <daniel.lundin.mail at gmail dot com> ---
The intention of DR 476 (Sebor)
https://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_476 was a
clarification leading to a volatile lvalue access being a side effect, as
opposed to an access of volatile objects. Changes from the DR were included in
C23.

The C23 n3054 draft now says "An access to an object through the use of an
lvalue of volatile-qualified type is a volatile access. A volatile access to an
object, modifying an object, modifying a file, or calling a function that does
any of those operations are all side effects-..."

This ought to result in stricter optimizing behavior from gcc, not the other
way around. As reported in bug 108298
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108298), gcc 11 and beyond rather
seems to optimize more aggressively, which it didn't up to version 10.4.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/33053] adopt accesses through a volatile-casted pointer as a GNU C extension
       [not found] <bug-33053-4@http.gcc.gnu.org/bugzilla/>
  2022-03-18 14:58 ` segher at gcc dot gnu.org
@ 2023-01-05  9:18 ` pinskia at gcc dot gnu.org
  2023-01-05 10:45 ` daniel.lundin.mail at gmail dot com
  2023-01-05 11:22 ` segher at gcc dot gnu.org
  3 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-05  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.lundin.mail at gmail dot co
                   |                            |m

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 108298 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/33053] adopt accesses through a volatile-casted pointer as a GNU C extension
       [not found] <bug-33053-4@http.gcc.gnu.org/bugzilla/>
@ 2022-03-18 14:58 ` segher at gcc dot gnu.org
  2023-01-05  9:18 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: segher at gcc dot gnu.org @ 2022-03-18 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

Segher Boessenkool <segher at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org

--- Comment #3 from Segher Boessenkool <segher at gcc dot gnu.org> ---
For C this is DR 476, which is on the way for C2x.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-05 11:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-12  9:50 [Bug c/33053] New: adopt accesses through a volatile-casted pointer as a GNU C extension segher at kernel dot crashing dot org
2007-08-18 14:10 ` [Bug c/33053] " rguenth at gcc dot gnu dot org
     [not found] <bug-33053-4@http.gcc.gnu.org/bugzilla/>
2022-03-18 14:58 ` segher at gcc dot gnu.org
2023-01-05  9:18 ` pinskia at gcc dot gnu.org
2023-01-05 10:45 ` daniel.lundin.mail at gmail dot com
2023-01-05 11:22 ` segher at gcc dot gnu.org

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).