NetBSD-Bugs archive

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

re: kern/51460: Source code bugs



> # diff -u ./sys/dev/acpi/fujhk_acpi.c.orig ./sys/dev/acpi/fujhk_acpi.c
> --- ./sys/dev/acpi/fujhk_acpi.c.orig    2016-08-31 21:55:27.000000000 +1000
> +++ ./sys/dev/acpi/fujhk_acpi.c 2016-08-31 22:13:25.000000000 +1000
> @@ -246,6 +246,7 @@
>         uint32_t irb;
>         int i, index;
> 
> +       irb = 0; /* make sure irb has been initialized */
>         for (i = 0; i < max_irb_buffer_size; i++) {
>                 if (fujitsu_hk_get_irb(sc, &irb) || irb == 0)
>                         return;
> #

this is a bug in GCC.  i've stopped patching our sources
to build with -O3 / -Os because of these sorts of issues.

eg, i haven't checked, but i fully expect that in the above
code that fujitsu_hk_get_irb(), which is local, always
sets irb if it returns true, but for some reason GCC thinks
it is a problem.  i've seen this pattern dozens of times.

i don't agree with Martin - i don't think we should "fix"
these cases, but simply advise not using '-O[3s] -Werror'.


.mrg.


Home | Main Index | Thread Index | Old Index