1 Aug 2009 02:41
Spurious warning in gcc SVN trunk
Kevin P. Fleming <kpfleming <at> digium.com>
2009-08-01 00:41:48 GMT
2009-08-01 00:41:48 GMT
Just for kicks, I pulled a copy of SVN trunk today, built it, and tried
compiling some existing code. While it caught a number of problems that
previous versions did not, it also reported a couple of cases that seem
spurious. Here's a small example:
> #include <stdlib.h>
> #include <stdio.h>
>
> int main(int argc, char **argv)
> {
> switch (argc) {
> case 0:
> {
> char *foo = malloc(1);
> if (!foo)
> TEST_LABEL:
> {
> printf("test\n");
> return 0;
> }
> free(foo);
> break;
> }
> case 1:
> {
> char *foo = "xyz";
> if (argv[0]) {
> goto TEST_LABEL;
> }
> printf(foo);
(Continue reading)
RSS Feed