[LLVMdev] gfortran: array constructor problems

Chris Lattner sabre at nondot.org
Wed Sep 6 01:06:27 PDT 2006


On Tue, 5 Sep 2006, Michael McCracken wrote:
> Hi, in order to get a handle on the questions in Chris's previous
> email, I rebuilt LLVM with debugging info, and then rebuilt gcc4 with
> CHECKING_ENABLED.
>
> In the process, I ran into an assertion error when compiling the first
> part of libgfortran:

ok.

> ../../src/gcc/llvm-convert.cpp:3871: failed assertion
> `(TREE_CONSTANT(exp) || TREE_CODE(exp) == STRING_CST) && "Isn't a
> constant!"'
>
> In this case, TreeConstantToLLVM::Convert() is getting a constant to
> convert that fails the test "TREE_CONSTANT(exp)"
> (from my gdb session:)
..
> I'm not entirely sure how to proceed here, so any advice would be appreciated.

Thanks for the details.

This looks like a typical case of "gcc being sloppy with the 'tree's it is 
generating".  I hit another case like this in the C++ front-end, which I 
fixed there (and committed a patch to mainline GCC).  It's preferable to 
find the offending code in the fortran frontend and add the 
'TREE_CONSTANT(exp) = 1' line where appropriate.  I don't know if you feel 
up to that, but it is the preferred solution.  It is possible that this is 
fixed in the GCC mainline fortran frontend, checking there might be a 
start.  It's also quite possible it isn't fixed, as GCC never does the 
equivalent assert so there may have been no reason for them to 
discover/fix this.

If you don't feel up to that, I'd be ok relaxing the assert, assuming that 
the generated code is in fact correct.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list