[Bug middle-end/69482] Writing through pointers to volatile not always preserved

2023-01-10 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482

Richard Biener  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=71793

--- Comment #13 from Richard Biener  ---
(In reply to Daniel Boles from comment #12)
> Is this the same cause as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71793
> ?

I think so but I found the testcase in that PR hard to validate with the fix,
so if you can confirm the issue is fixed there with the change that would be
great!

[Bug middle-end/69482] Writing through pointers to volatile not always preserved

2023-01-09 Thread dboles.src at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482

Daniel Boles  changed:

   What|Removed |Added

 CC||dboles.src at gmail dot com

--- Comment #12 from Daniel Boles  ---
Is this the same cause as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71793 ?

Thanks!

[Bug middle-end/69482] Writing through pointers to volatile not always preserved

2023-01-09 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482

Richard Biener  changed:

   What|Removed |Added

  Known to work||13.0

--- Comment #11 from Richard Biener  ---
fixed on trunk, queued for eventual backporting.

[Bug middle-end/69482] Writing through pointers to volatile not always preserved

2023-01-09 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482

--- Comment #10 from CVS Commits  ---
The master branch has been updated by Richard Biener :

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

commit r13-5066-ga5a8242153d078f1ebe60f00409415da260a29ee
Author: Richard Biener 
Date:   Mon Jan 9 12:46:28 2023 +0100

middle-end/69482 - not preserving volatile accesses

The following addresses a long standing issue with not preserving
accesses to non-volatile objects through volatile qualified
pointers in the case that object gets expanded to a register.  The
fix is to treat accesses to an object with a volatile qualified
access as forcing that object to memory.  This issue got more
exposed recently so it regressed more since GCC 11.

PR middle-end/69482
* cfgexpand.cc (discover_nonconstant_array_refs_r): Volatile
qualified accesses also force objects to memory.

* gcc.target/i386/pr69482-1.c: New testcase.
* gcc.target/i386/pr69482-2.c: Likewise.

[Bug middle-end/69482] Writing through pointers to volatile not always preserved

2023-01-09 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482

Richard Biener  changed:

   What|Removed |Added

 CC||daniel.lundin.mail at gmail 
dot co
   ||m

--- Comment #9 from Richard Biener  ---
*** Bug 108298 has been marked as a duplicate of this bug. ***

[Bug middle-end/69482] Writing through pointers to volatile not always preserved

2023-01-09 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69482

Richard Biener  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org

--- Comment #8 from Richard Biener  ---
Note we do expand volatile qualified variables to memory but this case is about
non-volatile qualified variables stored to through volatile qualified pointers.
So it's

int foo (int i)
{
  volatile int j = i;
  return j;
}

vs.

int bar (int i)
{
  int j;
  *(volatile int *)&j = i;
  return j;
}

I have a patch.