[LLVMbugs] [Bug 3797] initializer element is not a compile-time constant ( address of variable)

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Mar 23 04:41:23 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=3797


Philippe Coucaud <philippe.coucaud at nxp.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




--- Comment #2 from Philippe Coucaud <philippe.coucaud at nxp.com>  2009-03-23 06:40:05 ---
Douglas, I suspect you are using a 64-bit platform. When using gcc 4.2/4.3.2 on
a 32-bit platform I don't get the error. 

This seems to be confirmed by the following piece of code extracted from the
gcc source tree (gcc/varasm.c:initializer_constant_valid_p()):

[...]
        /* Allow (int) &foo provided int is as wide as a pointer.  */
        if (INTEGRAL_TYPE_P (dest_type) && POINTER_TYPE_P (src_type)
            && (TYPE_PRECISION (dest_type) >= TYPE_PRECISION (src_type)))
          return initializer_constant_valid_p (src, endtype);
[...]

So I think that the initial snippet is not always ill-formed. Deciding whether
clang should support this behaviour is of course another question.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list