return of C99 compound literal addresses doesn't yield warnings (original) (raw)
| Bugzilla Link | 8306 |
|---|---|
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
The following code warns about returning the adress of stack memory
struct stat *foo(void) { struct stat st;
return &st;}
The following code doesn't:
struct stat *foo(void) { return &(struct stat){ 0, }; }
or this one either:
void (^blk_t)(void);
blk_t foo(void) { return ^{ (void)0; } };
This is somehow similar to the issues in #8675 (but in worse because here the programmer is really used to the compiler reporting these mistakes)