This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Properly count number of elements in STRING_CST
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: rth at redhat dot com
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 24 Nov 04 17:44:38 EST
- Subject: Properly count number of elements in STRING_CST
We spoke about this a long time ago. It causes the determination of
whether something should be static or not to be wrong.
Do you agree this is correct?
Tested on x86_64-linux-gnu.
2004-11-24 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (categorize_ctor_elements_1, case STRING_CST): New case.
*** expr.c 24 Nov 2004 11:41:29 -0000 1.743
--- expr.c 24 Nov 2004 14:54:53 -0000
*************** categorize_ctor_elements_1 (tree ctor, H
*** 4153,4156 ****
--- 4153,4161 ----
nz_elts += mult;
break;
+
+ case STRING_CST:
+ nz_elts += mult * TREE_STRING_LENGTH (value);
+ break;
+
case COMPLEX_CST:
if (!initializer_zerop (TREE_REALPART (value)))
*************** categorize_ctor_elements_1 (tree ctor, H
*** 4159,4162 ****
--- 4164,4168 ----
nz_elts += mult;
break;
+
case VECTOR_CST:
{