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

Bug#650275: gcc-4.6: Does only detect division by zero for int, not float



Package: gcc-4.6
Version: 4.6.2-5
Severity: minor

Hi,

I find it strange and inconsistent that gcc only detects and reports hard-coded
devision by zero for int variables but not for those of type float. If you
compile the attached example, gcc will print the following warning:

$ gcc -W -Wall -Wextra nan.c
nan.c: In function ‘main’:
nan.c:6:18: warning: division by zero [-Wdiv-by-zero]

Please note that this warning is true for both lines 5 and 6.

Best Regards,
Fabian



-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (501, 'unstable'), (101, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.0.0-2-686-pae (SMP w/1 CPU core)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gcc-4.6 depends on:
ii  binutils      2.22-1        
ii  cpp-4.6       4.6.2-5       
ii  gcc-4.6-base  4.6.2-5       
ii  libc6         2.13-21       
ii  libgcc1       1:4.6.2-5     
ii  libgmp10      2:5.0.2+dfsg-2
ii  libgomp1      4.6.2-5       
ii  libmpc2       0.9-4         
ii  libmpfr4      3.1.0-3       
ii  libquadmath0  4.6.2-5       
ii  zlib1g        1:1.2.5.dfsg-1

Versions of packages gcc-4.6 recommends:
ii  libc6-dev  2.13-21

Versions of packages gcc-4.6 suggests:
pn  binutils-gold        <none>
pn  gcc-4.6-doc          <none>
pn  gcc-4.6-locales      <none>
pn  gcc-4.6-multilib     <none>
pn  libgcc1-dbg          <none>
pn  libgomp1-dbg         <none>
pn  libmudflap0-4.6-dev  <none>
pn  libmudflap0-dbg      <none>
pn  libquadmath0-dbg     <none>

-- no debconf information
#include <stdio.h>

int main (void)
{
        float f = 0/0.;
        int i = 0/0;

        printf("f: %f, i: %d\n", f, i);

        return 0;
}

Reply to: