[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed for 8.2+.

[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-20 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Jun 20 20:40:33 2018
New Revision: 261820

URL: https://gcc.gnu.org/viewcvs?rev=261820&root=gcc&view=rev
Log:
Backported from mainline
2018-06-15  Jakub Jelinek  

PR c/86093
* c-typeck.c (pointer_diff): Cast both pointers to unqualified types
before doing POINTER_DIFF_EXPR.

* c-c++-common/pr86093.c: New test.

Added:
branches/gcc-8-branch/gcc/testsuite/c-c++-common/pr86093.c
Modified:
branches/gcc-8-branch/gcc/c/ChangeLog
branches/gcc-8-branch/gcc/c/c-typeck.c
branches/gcc-8-branch/gcc/testsuite/ChangeLog

[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Fri Jun 15 20:53:54 2018
New Revision: 261663

URL: https://gcc.gnu.org/viewcvs?rev=261663&root=gcc&view=rev
Log:
PR c/86093
* c-typeck.c (pointer_diff): Cast both pointers to unqualified types
before doing POINTER_DIFF_EXPR.

* c-c++-common/pr86093.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/pr86093.c
Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/testsuite/ChangeLog

[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

--- Comment #3 from Jakub Jelinek  ---
Created attachment 44284
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44284&action=edit
gcc9-pr86093.patch

Untested fix.

[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

Jakub Jelinek  changed:

   What|Removed |Added

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

--- Comment #2 from Jakub Jelinek  ---
Started with r255021.

genmatch emits all checks as x == y || operand_equal_p (x, y, 0), the reason
why e.g.
long volatile i;
long foo (void) { return i - i; }
isn't optimized into 0 is that we actually wrap i into a NOP_EXPR to remove
quals and only do MINUS_EXPR on the result of those NOP_EXPRs, which don't
compare equal as pointers.  So I think we should just do the same with
POINTER_DIFF_EXPR, cast the operands to unqualified pointers.

[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |8.2

[Bug c/86093] [8/9 Regression] volatile ignored on pointer in C

2018-06-08 Thread amonakov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093

Alexander Monakov  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-06-08
 CC||amonakov at gcc dot gnu.org
  Known to work||7.3.0
Summary|volatile ignored on pointer |[8/9 Regression] volatile
   |in C|ignored on pointer in C
 Ever confirmed|0   |1
  Known to fail||8.1.0, 9.0

--- Comment #1 from Alexander Monakov  ---
gcc-7 got this right.