[Bug c/53603] abs() doesn't warn if argument is double, not even with -Wall -Wextra

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Thu Jun 7 13:55:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53603

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-06-07 13:55:05 UTC ---
Use -Wconversion:

[macbook] f90/bug% gcc48 -Wconversion pr53603.c
pr53603.c: In function 'main':
pr53603.c:6:9: warning: conversion to 'int' from 'double' may alter its value
[-Wconversion]
         y = abs (x);
         ^

although I'ld expect the caret under x. For 4.4 to 4.7 one gets

pr53603.c: In function 'main':
pr53603.c:6: warning: conversion to 'int' from 'double' may alter its value



More information about the Gcc-bugs mailing list