10-300u+10.0l gives erroneous result 4294967016.000000 (instead of -280.0) (in 
C)
If I am not mistaken, binary - and + have the same precedence, left to right
associativity.

10-300u correct yields -290, but 10-300u+10.0l = (10-300u)+10.0l gives incorrect
result. I believe, if 10-300u=-290, then -290+10.0l gives -280.0l with arithmic
promotion to long double.

Also, -300u gives -300, yet (long double) (-300) gives 4294966996.000000
This does not seem a correct cast.

-- 
           Summary: Erroneous automatic typecasting (unsigned int -> long
                    double)
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: P dot Altena at amolf dot nl
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to