User account creation filtered due to spam.

Bug 31279 - Uninitialized warning for call-by-reference arguments with known intent(in)
Summary: Uninitialized warning for call-by-reference arguments with known intent(in)
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: diagnostic
Depends on: 31094
Blocks: Wuninitialized
  Show dependency treegraph
Reported: 2007-03-20 15:41 UTC by Tobias Burnus
Modified: 2017-03-02 10:09 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2012-02-02 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-03-20 15:41:56 UTC
In Fortran one can specify the intent of variables thus if all arguments have INTENT(IN) then GCC should be able to detect that alist in the call to cshift is uninitialized.

This depends on the middle end support of intents (PR31094) plus using these in gfortran.

Example (using an intrinsic function):

program testcshft
  integer :: alist(4)
  alist =cshift(alist,-1)
  write(*,*) alist
end program testcshft
Comment 1 Andrew Pinski 2012-02-02 17:49:32 UTC
Comment 2 Dominique d'Humieres 2013-06-25 09:10:09 UTC
Still no warning at revision 200371.
Comment 3 Richard Biener 2017-03-02 10:09:49 UTC
Several(?) C duplicates exist which implicitely suggest a similar attribute.

void bar (int *);
void foo ()
  int i;
  bar (&i);

if we can annotate the first arg of 'bar' as "intent in" (aka, should be
fully(!) initialized) then we can warn on this use.