Warning using -Wconversion and -Ox in gcc 4.5 and 4.6 but not in previous releases

José Luis García Pallero jgpallero@gmail.com
Mon Mar 7 22:02:00 GMT 2011


El día 7 de marzo de 2011 15:28, Cedric Roux <cedric.roux@acri-st.fr> escribió:
>> But why in previous gcc versions the warning didn't appears. And
>> strspn() is a common function in string.h. I don't understand why the
>> call to strspn() with correct arguments emits a warning.
>
> Because it's most certainly a bug.

Can anyone upload a bug report to gcc bugzilla or gcc-bug mailing
list? I'm not subscribed

> #include <string.h>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main() {
>  size_t x;
>  x = strspn("hello","h");
>  printf("%zd\n", x);
>  return 0;
> }
>
> warns too at -O, -O1, -O2, -O3 with -Wconversion. And the value is correctly
> used and so on.
>



-- 
*****************************************
José Luis García Pallero
jgpallero@gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************



More information about the Gcc-help mailing list