This is the mail archive of the gcc@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] |
On Thu, 28 Jan 2016 19:10:03 +0100 Andreas Schwab <schwab@linux-m68k.org> wrote: > Why does the dummy declaration need to use a pointer type? Just a historical remnant. Historically it was a single declaration used for both "known" prototypes (for functions generated by GHC) and "unknown" prototypes (arbitrary C functions called by haskell code). GHC-generated "known" functions have prototype void * (*)(void); Historically it was a shortcut to reuse the same prototype for "unknown" functions. It was a mistake. This mistake led to breakage for powerpc64le and this shared prototype was relaxed down to incomplete prototype both for "known" and "unknown" functions to: void * (*)(); at a performance and type safety cost for "known" functions. Splitting "known"/"unknown" cases is an obvious change in GHC which was done in https://git.haskell.org/ghc.git/commitdiff/90e1e160b783644c2d3cc0a05e3a804cea549cf9 a few days ago. Now "known" functions have precise type of void * (*)(void); and "unknown" functions have incomplete type void (*)(); It seems to fix m68k but there is no reason not to break later if gcc will assume stack layout setup by caller (if there are targets in the world passing all results using stack). GHC only calls C functions that can fit the result in a single register thus 'void *' did look safe safe :) It would be nice to have more stable workaround :) -- Sergei
Attachment:
signature.asc
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |