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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|middle-end                  |fortran

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
GCC added the attributes mentioned in comment #4 under the name access -- see
below.  Getting the middle end to issue a warning for the cases described in
comment #0 should be a matter of the Fortran front end making use of the
attribute.

$ cat x.c && gcc -S -Wall x.c
__attribute__ ((access (read_only, 1))) void f (int*);

void g (void)
{
  int x;
  f (&x);
}
x.c: In function ‘g’:
x.c:6:3: warning: ‘x’ is used uninitialized [-Wuninitialized]
    6 |   f (&x);
      |   ^~~~~~
x.c:1:46: note: in a call to ‘f’ declared with attribute ‘access (read_only,
1)’ here
    1 | __attribute__ ((access (read_only, 1))) void f (int*);
      |                                              ^
x.c:5:7: note: ‘x’ declared here
    5 |   int x;
      |       ^

Reply via email to