http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45821

--- Comment #3 from Andrew Gaul <gcc at gaul dot org> 2010-09-28 17:51:21 UTC 
---
The web form truncates all my attachedments at 244 bytes.  Here is the source
inline:

/*
 * GCC warns about returning a local variable address within a function but not
 * within a statement expression:
 *
 * $ gcc statement_expression_return_local.c -c -Wall
 * statement_expression_return_local.c: In function ‘function_return_local’:
 * statement_expression_return_local.c:13: warning: function returns address of
local variable
 */

int *function_return_local(void)
{
    int x = 0;
    return &x;
}

int *statement_expression_return_local(void)
{
    int *y = ({
        int x = 0;
        &x;
    });
    return y;
}

Reply via email to