[Bug c/63886] New: float will fit into int with abs - possible missing warning Wabsolute-value
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Nov 15 13:16:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63886
Bug ID: 63886
Summary: float will fit into int with abs - possible missing
warning Wabsolute-value
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
# include <stdlib.h>
extern void g(int);
void f( float qw)
{
int n = abs(qw);
g(n);
}
$ ~/gcc/results/bin/gcc -c -g -O2 -Wall -Wextra -pedantic nov15z.c
$ ~/gcc/results/bin/gcc -v
gcc version 5.0.0 20141112 (experimental) (GCC)
$ ~/llvm/results/bin/clang -c -g -O2 -Wall nov15z.c
nov15z.c:10:10: warning: using integer absolute value function 'abs' when
argument is of floating point type [-Wabsolute-value]
int n = abs(qw);
^
More information about the Gcc-bugs
mailing list