[cfe-commits] r52049 - in /cfe/trunk: lib/CodeGen/CGExprConstant.cpp test/CodeGen/struct-init.c
Eli Friedman
eli.friedman at gmail.com
Fri Jun 6 16:53:23 PDT 2008
On Fri, Jun 6, 2008 at 9:41 AM, Nuno Lopes <nunoplopes at sapo.pt> wrote:
> Author: nlopes
> Date: Fri Jun 6 11:41:08 2008
> New Revision: 52049
>
> URL: http://llvm.org/viewvc/llvm-project?rev=52049&view=rev
> Log:
> implement constant expr. sub ptr ptr
> --- cfe/trunk/test/CodeGen/struct-init.c (added)
> +++ cfe/trunk/test/CodeGen/struct-init.c Fri Jun 6 11:41:08 2008
> @@ -0,0 +1,13 @@
> +// RUN: clang %s -emit-llvm
> +
> +typedef struct _zend_ini_entry zend_ini_entry;
> +struct _zend_ini_entry {
> + void *mh_arg1;
> +};
> +
> +char a;
> +
> +const zend_ini_entry ini_entries[] = {
> + { ((char*)&((zend_ini_entry*)0)->mh_arg1 - (char*)(void*)0)},
> + { ((long long*)&a - (long long*)(void*)2)},
> +};
I have a few things to ask about this testcase. First off, without
some hacking on Sema on my end, this testcase doesn't pass; do you
have a hack in your tree to be looser about constant expressions?
Secondly, is the "((long long*)&a - (long long*)(void*)2)" case from
real code? Supporting the case where the base is a null pointer in
Sema is a lot easier than that one, so if it isn't from real code, I'm
not going to bother supporting it.
-Eli
More information about the cfe-commits
mailing list