Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#3336 closed bug (fixed)

Following gcc behaviour with regards to calling conventions on x86_64

Reported by: JeffersonHeard Owned by:
Priority: normal Milestone: 7.0.1
Component: Compiler Version: 6.10.3
Keywords: calling convention, stdcall Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by igloo)

Right now, if anything other than ccall is given to ghc on x86_64 architectures, ghc errors out with the complaint that the calling convention is not supported on this architecture. gcc on the other hand, handles this situation gracefully, ignoring the calling convention attribute. My thought is that ghc should do this as well.

Currently, I get this:

    calling convention not supported on this architecture: stdcall
    When checking declaration:
        foreign import stdcall unsafe "static  &c_tepoint_setobjectid" tepoint_setobjectid
          :: TePointPtr -> CString -> IO ()

I think I should instead get a warning saying that the calling convention is being ignored.

Change History (5)

comment:1 Changed 9 years ago by igloo

Description: modified (diff)
difficulty: Unknown

comment:2 Changed 9 years ago by igloo

Milestone: 6.14.1

Thanks for the report

comment:3 Changed 8 years ago by simonmar

Status: newmerge
Type of failure: None/Unknown


Fri Sep 24 08:24:45 PDT 2010  Simon Marlow <>
  * Using 'stdcall' when it is not supported is only a warning now (#3336)

    M ./compiler/ghci/LibFFI.hsc -1 +2
    M ./compiler/typecheck/TcForeign.lhs -1 +2

comment:4 Changed 8 years ago by igloo

Resolution: fixed
Status: mergeclosed


comment:5 Changed 7 years ago by dmp@…

commit 521157f905926556eaa02a8fbb2f0645efe24a80

Author: David M Peixotto <>
Date:   Thu Oct 20 09:18:19 2011 -0500

    Ignore stdcall c-call in native codegen on x86_64
    The stdcall calling convention is not supported on x86_64.
    When an ffi import requests stdcall, a warning is issued as
    desired by #3336. However, the native codegen was still
    generating code that expected the callee to cleanup the
    stack arguments when calling a c function that requests
    This patch changes the codegen to actually use the ccall
    calling convention as intended.
    Signed-off-by: David Terei <>

 compiler/nativeGen/X86/CodeGen.hs |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
Note: See TracTickets for help on using tickets.