On Sat, 5 Apr 2014, Marc Glisse wrote:
> One hard part is avoiding duplicate warnings. Replacing the address with 0 is
> a convenient way to do that, so I did it both for my new warning and for the
> existing C/C++ ones. The patch breaks gfortran.dg/warn_target_lifetime_2.f90
That's not safe the way you do it; you lose side effects from the original
return value. Consider a testcase such as:
extern void exit (int);
extern void abort (void);
int *
f (void)
{
int a[10];
return &a[(exit (0), 0)];
}
int
main (void)
{
f ();
abort ();
}
(which produces the existing warning, but which has behavior fully defined
to exit with status 0).
--
Joseph S. Myers
[email protected]