[Bug testsuite/82770] [8 regression] gcc.dg/pr78768.c xpass
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 10 16:30:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82770
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=79062
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> With -v you can clearly see the warnings are emitted from lto1. If you'd
> use fat LTO objects you'd see them twice but the testcase requires a linker
> plugin.
This doesn't sound quite right. In your analysis of bug 79062 you explained
one part of the problem. The same bug 79062, comment 7, shows there is no
warning for the sprintf call in the following, with or without -v (there is one
without -flto) even with the suggested fix.
$ (gcc -O2 -Wall -Walloca-larger-than=1 -flto -c -v pr78768.c && gcc -O2 -Wall
-Walloca-larger-than=1 -flto -v pr78768.o) 2>&1 | grep warning
int main (void)
{
char *d = (char*)__builtin_alloca (2);
__builtin_sprintf (d, "%i", 123);
__builtin_puts (d);
}
pr78768.c:10:21: warning: argument to ‘alloca’ is too large
[-Walloca-larger-than=]
char *d = (char *)__builtin_alloca (12); /* { dg-warning "argument to
.alloca. is too large" } */
With -fat-lto-objects there is only one warning for the sprintf call (without
the fix shown in bug 79062, comment 3).
$ (gcc -O2 -Wall -Walloca-larger-than=1 -ffat-lto-objects -flto -c -v pr78768.c
&& gcc -O2 -Wall -Walloca-larger-than=1 -ffat-lto-objects -flto -v pr78768.o)
2>&1 | grep warning
pr78768.c:10:21: warning: argument to ‘alloca’ is too large
[-Walloca-larger-than=]
char *d = (char *)__builtin_alloca (12); /* { dg-warning "argument to
.alloca. is too large" } */
pr78768.c:12:26: warning: ‘%32s’ directive writing 32 bytes into a region of
size 12 [-Wformat-overflow=]
__builtin_sprintf (d, "%32s", "x"); /* { dg-warning "directive writing 32
bytes into a region of size 12" "-Wformat-overflow" } */
__builtin_sprintf (d, "%32s", "x"); /* { dg-warning "directive writing 32
bytes into a region of size 12" "-Wformat-overflow" } */
pr78768.c:10:21: warning: argument to ‘alloca’ is too large
[-Walloca-larger-than=]
char *d = (char *)__builtin_alloca (12); /* { dg-warning "argument to
.alloca. is too large" } */
I don't mind resolving this as fixed because bug 79062 tracks the outstanding
problem.
More information about the Gcc-bugs
mailing list