This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/36300] New: Incorrect type used for inlined expression


System: Debian 2.6.22.8-mw017
GCC: gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

In the expression below:
- VALUE has type uint32_T
- Y gets a wrong result.
- If VALUE is assigned to an int32_T variable, and the variable is used instead
of VALUE, Y gets the correct result.

See attached file missing_downcast.c for more details and reproduction steps

-----------------

#define VALUE ((int32_T)((int64_T)U1 * (int64_T)3 >> 2) + 2)
  Y = (int32_T)(   (int64_T)(VALUE * VALUE) 
                 * 
                   (int64_T)954437177
                 >> 
                   29
               );


-- 
           Summary: Incorrect type used for inlined expression
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: acarmeli at mathworks dot com


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]