diff options
author | oldham <oldham@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-28 19:35:56 +0000 |
---|---|---|
committer | oldham <oldham@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-12-28 19:35:56 +0000 |
commit | 77ed70ed7ef7921b1eb9c026667094e7b7801c95 (patch) | |
tree | 21b4d104e3a6523b2bdf308b6a38174f6e35b602 /gcc | |
parent | 25f9f667a94d45c1b38aa7307955814b727410c7 (diff) | |
download | gcc-77ed70ed7ef7921b1eb9c026667094e7b7801c95.tar.gz |
2000-12-28 Jeffrey Oldham <oldham@codesourcery.com>
* varasm.c (initializer_constant_valid_p): Indicate subtraction of
pointers to the same string constant is absolute.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38514 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/varasm.c | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e826e1cf91b..3230e138815 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-12-28 Jeffrey Oldham <oldham@codesourcery.com> + + * varasm.c (initializer_constant_valid_p): Indicate subtraction of + pointers to the same string constant is absolute. + 2000-12-28 Joseph S. Myers <jsm28@cam.ac.uk> * c-common.c (enum format_type): Add strfmon_format_type. diff --git a/gcc/varasm.c b/gcc/varasm.c index b2c283e13b7..8f76f45f719 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -4252,6 +4252,14 @@ initializer_constant_valid_p (value, endtype) Then the value is absolute. */ if (valid0 == valid1 && valid0 != 0) return null_pointer_node; + + /* Since GCC guarantees that string constants are unique in the + generated code, a subtraction between two copies of the same + constant string is absolute. */ + if (valid0 && TREE_CODE (valid0) == STRING_CST && + valid1 && TREE_CODE (valid1) == STRING_CST && + TREE_STRING_POINTER (valid0) == TREE_STRING_POINTER (valid1)) + return null_pointer_node; } /* Support differences between labels. */ |