Re: gcc-4.6.0-0.12.fc15.x86_64 breaks strcmp?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adam Jackson wrote:

> On 3/7/11 10:35 AM, Richard W.M. Jones wrote:
>
>> Below is how the failure line expands(!)
>
> Thanks, I needed a laugh this morning.
>
> If I do this as a minimal testcase:
>
> ---
>
> #include <string.h>
> #include <stdio.h>
>
> int
> do_rm_rf (const char *path)
> {
>    int r;
>    char *buf, *err;
>
>    if (!strcmp(path, "/")) {
>      printf ("cannot remove root directory");
>      return -1;
>    }
>
>    return 0;
> }

Shame on me.
I forgot string.h and -Wall ;-)

With the former and -O3, I do see your warning.
Here's a pared-down test case:

    $ cat k.c
    #include <string.h>
    void do_rm_rf (const char *p) { if (strcmp (p, "/") == 0) return; }
    $ gcc -Wall -O3 -c k.c -Werror=strict-overflow
    k.c: In function âdo_rm_rfâ:
    k.c:2:1678: error: assuming signed overflow does not occur when changing X +- C1 cmp C2 to X cmp C1 +- C2 [-Werror=strict-overflow]
    cc1: some warnings being treated as errors

    [Exit 1]
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux