[cfe-dev] -O4 with #include <iostream>
Toralf Niebuhr
niebuhr at niebuhrt.de
Sun Jul 4 12:24:42 PDT 2010
Am 04.07.2010 um 18:50 schrieb Chris Lattner:
> On Jul 4, 2010, at 2:47 AM, Toralf Niebuhr wrote:
>
>> I recently asked why something doesn't compile. With the latest trunk it compiles fine under some conditions.
>
> What version of clang are you using? The code that is causing the error has been completely removed. Can you try with mainline?
>
I am on the current llvm (r107591)/clang(r107591) trunk
Both repositories are up to date. I use the URLs to the svn from this site: http://clang.llvm.org/get_started.html
When compiling with -v I get "clang -cc1 version 2.8 based upon llvm 2.8svn hosted on x86_64-apple-darwin10"
I attached the complete error log that I get with the -v option set.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.log
Type: application/octet-stream
Size: 3321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100704/a24b04c0/attachment.obj>
-------------- next part --------------
> -Chris
>
>>
>> // ---- Out.h
>> class Out {
>> public:
>> void out();
>> };
>>
>> // ---- Out.cpp
>> #include "Out.h"
>> #include <iostream>
>>
>> void Out::out() {
>> std::cout << "Hello World" << std::endl;
>> }
>>
>> // ---- main.cpp
>> #include "Out.h"
>>
>> int main() {
>> Out o;
>> o.out();
>> return 0;
>> }
>>
>> compiling this with
>> clang++ -O4 -o main main.cpp Out.cpp
>> gives the following error
>>
>> Alloca array size must be i32
>> %o = alloca %class.Out, void (%class.Out*)* @_ZN3Out3outEv, align 2 ; <%class.Out*> [#uses=1]
>> Instruction does not dominate all uses!
>> %o = alloca %class.Out, void (%class.Out*)* @_ZN3Out3outEv, align 2 ; <%class.Out*> [#uses=1]
>> call void @_ZN3Out3outEv(%class.Out* %o)
>> Broken module found, compilation aborted!
>> Stack dump:
>> 0. Running pass 'Function Pass Manager' on module 'ld-temp.o'.
>> 1. Running pass 'Module Verifier' on function '@main'
>>
>>
>> The interesting thing is the following
>>
>> if I modify main.cpp to
>>
>> // ---- main.cpp
>> #include "Out.h"
>> #include <iostream>
>>
>> int main() {
>> Out o;
>> o.out();
>> return 0;
>> }
>>
>> It compiles fine and the binary runes fine too.
>>
>> This makes me think that there was to much optimization done during compile time when compiling Out.cpp
>>
>> Any ideas?
>>
>>
>> Toralf
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list