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]

[PATCH] Fix darwin_mergeable_string_section (PR target/34622)


Hi!

darwin_mergeable_string_section puts into .cstring section even STRING_CSTs
which aren't mergeable, because they contain more than one '\0' at the end.
Fixed thusly, regtested i686-apple-darwin9 by Dominique d'Humieres.
Ok for trunk?

2008-01-07  Jakub Jelinek  <jakub@redhat.com>

	PR target/34622
	* config/darwin.c (darwin_mergeable_string_section): Don't use
	.cstring if int_size_in_bytes != TREE_STRING_LENGTH.

--- gcc/config/darwin.c.jj	2007-10-11 10:54:22.000000000 +0200
+++ gcc/config/darwin.c	2008-01-07 15:57:52.000000000 +0100
@@ -1136,6 +1136,8 @@ darwin_mergeable_string_section (tree ex
       && TREE_CODE (exp) == STRING_CST
       && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
       && align <= 256
+      && (int_size_in_bytes (TREE_TYPE (exp))
+	  == TREE_STRING_LENGTH (exp))
       && ((size_t) TREE_STRING_LENGTH (exp)
 	  == strlen (TREE_STRING_POINTER (exp)) + 1))
     return darwin_sections[cstring_section];

	Jakub


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