logo       

[ ghc-Bugs-830247 ] When compiled with -O2, we get extra warnings: msg#00062

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-830247 ] When compiled with -O2, we get extra warnings

Bugs item #830247, was opened at 2003-10-25 23:10
Message generated for change (Comment added) made by wthaller
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=830247&group_id=8032

Category: Compiler (FFI)
Group: 6.0.1
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: When compiled with -O2, we get extra warnings

Initial Comment:
This is happending on a WinXP installation:
-----------------------------------------------
[arf]~/tst>cat Main.hs
module Main where

import CString

foreign import ccall "readline" gnuRL :: CString -> IO
CString

main = main
[arf]~/tst>ghc --version
The Glorious Glasgow Haskell Compilation System,
version 6.0.1
[arf]~/tst>ghc -c -ffi Main.hs
[arf]~/tst>rm Main.o Main.hi
[arf]~/tst>ghc -O2 -c -ffi Main.hs
c:/DOCUME~1/lerkok/LOCALS~1/Temp/ghc2484.hc: In
function `s1cV_entry':
c:/DOCUME~1/lerkok/LOCALS~1/Temp/ghc2484.hc:52:
warning: implicit declaration of function `readline'
c:/DOCUME~1/lerkok/LOCALS~1/Temp/ghc2484.hc:52:
warning: assignment makes pointer from integer without
a cast
--------------------------------------------------

For some reason, compiling with -O2 produces these
warnings that don't show up otherwise.


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

>Comment By: Wolfgang Thaller (wthaller)
Date: 2003-10-25 23:34

Message:
Logged In: YES
user_id=566359

You need to specify a header file in the foreign import declaration,
like this:
foreign import ccall "readline/readline.h readline" gnuRL :: CString
-> IO CString
or on the command line, using the -# include option, or in an
OPTIONS pragma.

The reason why these warnings are only reported with -O is that
GHC uses it's own native code generator most of the time, which
doesn't use the headers, but uses GCC when optimizing, which
does use them.


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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=830247&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise