target/9601: [i386] -mrtd switch/stdcall attribute raises warnings for __buitltin functions

dannysmith@clear.net.nz dannysmith@clear.net.nz
Thu Feb 6 20:16:00 GMT 2003


>Number:         9601
>Category:       target
>Synopsis:       [i386] -mrtd switch/stdcall attribute raises warnings for __buitltin functions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 06 20:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Danny Smith
>Release:        gcc version 3.4 20030130 (experimental)
>Organization:
>Environment:
i386-pc-mingw32, NT4-sp6
>Description:
Using the -mrtd switch or declaring standard library functions with __attribute__ ((stdcall)) raise warnings about builtin functions.  Warnings are emitted only when compiled as C, not C++

This testcase (test-mrtd.c)
=====begin======
/* test-mrtd.c */
double  __attribute__((cdecl))  sqrt (double);
double  __attribute__((stdcall)) log (double);
double  cos (double);
=====-end=======

Using -mrtd switch:
D:\TEMP>gcc  -c  -mrtd test-mrtd.c 
test-mrtd.c:1: warning: conflicting types for built-in function `sqrt'
test-mrtd.c:3: warning: conflicting types for built-in function `cos'

while, using C (cdecl) convention as default

D:\TEMP>gcc  -c  test-mrtd.c 
test-mrtd.c:2: warning: conflicting types for built-in function `log'

Looking at assembly for  code that actually uses  the declared functions, it appears that the cdecl (C) calling convention is used for functions with builtin versions, regardless of the attribute on the declaration.

This is not a regression.  The same problem occurs in 2.95.
>How-To-Repeat:
Testcase in description.
>Fix:
Unknown.  If declarations are in system headers, then the
#pragma GCC system_header disables the warnings for GCC >= 3.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list