tree-ssa-structalias.c (get_constraint_for_component_ref): Do not punt for STRING_CST.

* tree-ssa-structalias.c (get_constraint_for_component_ref): Do not
	punt for STRING_CST.
	(get_constraint_for): Deal with STRING_CST here instead.

From-SVN: r134325
This commit is contained in:
Eric Botcazou 2008-04-15 18:22:51 +00:00 committed by Eric Botcazou
parent 3bb3bb2d6e
commit bd1f29d927
4 changed files with 44 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2008-04-15 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-structalias.c (get_constraint_for_component_ref): Do not
punt for STRING_CST.
(get_constraint_for): Deal with STRING_CST here instead.
2008-04-15 Richard Guenther <rguenther@suse.de>
* tree-ssa-propagate.c (substitute_and_fold): Substitute

View File

@ -1,3 +1,7 @@
2008-04-15 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/string_slice2.adb: New test.
2008-04-15 Richard Guenther <rguenther@suse.de>
* gcc.dg/fold-compare-2.c: Adjust testcase.

View File

@ -0,0 +1,24 @@
-- { dg-do compile }
-- { dg-options "-O" }
with Ada.Strings;
with Ada.Strings.Fixed;
procedure String_Slice2 is
package ASF renames Ada.Strings.Fixed;
Delete_String : String(1..10);
Source_String2 : String(1..12) := "abcdefghijkl";
begin
Delete_String := Source_String2(1..10);
ASF.Delete(Source => Delete_String,
From => 6,
Through => Delete_String'Last,
Justify => Ada.Strings.Left,
Pad => 'x');
end;

View File

@ -2657,11 +2657,6 @@ get_constraint_for_component_ref (tree t, VEC(ce_s, heap) **results)
t = get_ref_base_and_extent (t, &bitpos, &bitsize, &bitmaxsize);
/* String constants are readonly, so there is nothing to really do
here. */
if (TREE_CODE (t) == STRING_CST)
return;
get_constraint_for (t, results);
result = VEC_last (ce_s, *results);
result->offset = bitpos;
@ -2779,6 +2774,16 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
return;
}
/* String constants are read-only. */
if (TREE_CODE (t) == STRING_CST)
{
temp.var = readonly_id;
temp.type = SCALAR;
temp.offset = 0;
VEC_safe_push (ce_s, heap, *results, &temp);
return;
}
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
case tcc_expression: