[Bug c/53277] New: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-08 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

 Bug #: 53277
   Summary: Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and
4.7 but not in previous releases
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: jgpall...@gmail.com


Hello:

In this example:

#include
#include
int main() {
strspn("hello","h");
return 0;
}

I obtain the warning:

test.c:4:5: warning: conversion to ‘size_t’ from ‘int’ may change the sign of
the result [-Wsign-conversion]

using the order:

gcc -Wall -Wextra -Wconversion -O test.c -o test

The warning appears with -O, -O1, -O2 and -O3, but not with -O0. The
warning appears in gcc 4.5, 4.6 and 4.7 but not in previous releases.

This behavior appears too if I do some assign:

#include 
#include 
#include 


int main() {
  size_t x;
  x = strspn("hello","h");
  printf("%zd\n", x);
  return 0;
}

I think this is a bug

Cheers


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #2 from José Luis García Pallero  
2012-05-09 10:50:35 UTC ---
Created attachment 27354
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27354
Original C code


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #3 from José Luis García Pallero  
2012-05-09 10:51:15 UTC ---
Created attachment 27355
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27355
Preprocessed with -O0 optimization flag


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #4 from José Luis García Pallero  
2012-05-09 10:51:52 UTC ---
Created attachment 27356
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27356
Preprocessed with -O1 optimization flag


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #5 from José Luis García Pallero  
2012-05-09 10:52:50 UTC ---
Created attachment 27357
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27357
Preprocessed with -O2 optimization flag


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #6 from José Luis García Pallero  
2012-05-09 10:53:19 UTC ---
Created attachment 27358
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27358
Preprocessed with -O3 optimization flag


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #7 from José Luis García Pallero  
2012-05-09 10:54:33 UTC ---
Hello:

I attach the preprocessed files with optimization flags -O0, -O1, -O2 and -O3

Thanks


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #8 from José Luis García Pallero  
2012-05-09 10:56:34 UTC ---
I have used gcc 4.7.0


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #11 from José Luis García Pallero  
2012-05-09 13:06:56 UTC ---
Report to glibc sent


[Bug c/53277] Warning using -Wconversion and -Ox in gcc 4.5, 4.6 and 4.7 but not in previous releases

2012-05-09 Thread jgpallero at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53277

--- Comment #14 from José Luis García Pallero  
2012-05-09 15:01:30 UTC ---
Fixed in glibc:

http://sourceware.org/bugzilla/show_bug.cgi?id=14083
http://sourceware.org/git/?p=glibc.git;a=commit;h=1a4b75a190006bb013a61f2031a4de86e93a629f