[Bug tree-optimization/41898] GCC ignores restrict on array

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 29 00:54:00 GMT 2020


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2009-11-01 20:59:25         |2020-2-28
                 CC|                            |msebor at gcc dot gnu.org
      Known to fail|                            |10.0, 4.5.3, 4.6.4, 4.7.4,
                   |                            |4.8.4, 4.9.4, 5.5.0, 6.4.0,
                   |                            |7.2.0, 8.0, 9.2.0

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
The test case in comment #0 is optimized, presumably thanks to r255093.  The
test case in comment #2 is also optimized, but the test case in comment #1 is
still not.  I assume this bug is still open because of that, so reconfirming.

$ cat pr41898.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout pr41898.c

int * __restrict__ a[1];
int * __restrict__ b[1];

extern void link_error (void);

int main()
{
  a[0][0] = 0;
  b[0][0] = 1;
  if (a[0][0] != 0)
    link_error ();
  return 0;
}

;; Function main (main, funcdef_no=0, decl_uid=1933, cgraph_uid=1,
symbol_order=2) (executed once)

Removing basic block 5
main ()
{
  int * _1;
  int * _2;
  int _3;

  <bb 2> [local count: 1073741824]:
  _1 = a[0];
  *_1 = 0;
  _2 = b[0];
  *_2 = 1;
  _3 = *_1;
  if (_3 != 0)
    goto <bb 3>; [33.00%]
  else
    goto <bb 4>; [67.00%]

  <bb 3> [local count: 354334800]:
  link_error ();

  <bb 4> [local count: 1073741824]:
  return 0;

}


More information about the Gcc-bugs mailing list