[Bug c/17168] [3.4/3.5 Regression] incorrect value passed to subroutine

wilson at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Aug 26 00:48:00 GMT 2004


------- Additional Comments From wilson at gcc dot gnu dot org  2004-08-26 00:48 -------
This is invalid code.  You are passing an "int" value to an unprototyped
function that requires a "long" value.  There is no promotion of the value in
this case, and hence no guarantee that the testcase will work.

This will work in the vast majority of cases though.  Often int and long will be
the same size in which case it works.  For 64-bit targets, the ABI will usually
require promoting int arguments to long in the caller, in which case this work.
 However, for IA-64, the ABI says that int arguments are promoted in the callee
(if at all), and hence this testcase is not guaranteed to work.

If will work if you write
void foo (long D) { ... }



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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



More information about the Gcc-bugs mailing list