Bug 88014 - Restrict/C2X/N2260 Restricted function argument
Summary: Restrict/C2X/N2260 Restricted function argument
Status: RESOLVED DUPLICATE of bug 87610
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: alias, wrong-code
Depends on:
Blocks: restrict
  Show dependency treegraph
Reported: 2018-11-14 08:16 UTC by mcccs
Modified: 2018-11-14 08:39 UTC (History)
0 users

See Also:
Known to work:
Known to fail:
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description mcccs 2018-11-14 08:16:07 UTC
N2260 ( http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2260.pdf )
has been integrated to C2X, according to
https://gustedt.wordpress.com/2018/11/12/c2x/ .

Code taken from the paper above:

#include <stdio.h>
void g(int **a, int *b)
*a = b;
int foo(int * restrict p, int *q)
g(&q, p); // effectively q = p
*p = 1;
*q = 2;
return *p + *q;
int main()
int x, y;
printf("%d", foo(&x, &y));
return 0;

Args: -O0

Result: 4 (correct)

Args: -fno-inline -O3

Result: 3 (incorrect)
Comment 1 Richard Biener 2018-11-14 08:39:56 UTC
This has been fixed on the GCC 8 branch already.

*** This bug has been marked as a duplicate of bug 87610 ***