This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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:
  	  {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]