The intent of the patch change is clear.
The strange thing concern the variable "A" declared this way "A : String (1 ..
1);", used that way "A := F;" and displayed in tree (gnu_target) as a
RECORD_TYPE instead of an ARRAY_TYPE.
The test to know if a temporary for return value is needed only check
ARRAY_RANGE_REF and ARRAY_TYPE and not RECORD_TYPE :
TREE_CODE (gnu_target) == ARRAY_RANGE_REF
||
(TREE_CODE (TREE_TYPE (gnu_target)) == ARRAY_TYPE
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_target))) == INTEGER_CST)
I don't why in my case fixed Strings are RECORD_TYPE and not ARRAY_TYPE.
Maybe its normal and I should extend the if condition with RECORD_TYPE :
TREE_CODE (gnu_target) == ARRAY_RANGE_REF
||
(TREE_CODE (TREE_TYPE (gnu_target)) == ARRAY_TYPE
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_target))) == INTEGER_CST)
||
(TREE_CODE (TREE_TYPE (gnu_target)) == RECORD_TYPE
&& TREE_CODE (TYPE_SIZE (TREE_TYPE (gnu_target))) == INTEGER_CST)
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] De la part de Eric
Botcazou
Envoyé : vendredi 6 juin 2014 10:20
À : BELBACHIR Selim
Cc : [email protected]
Objet : Re: Gimplilfy ICE in gnat.dg/array18.adb
> strangely my var_decl for 'a' is a record and not an array_type so the 'if'
> condition is false (and true on X86_64).... I looked for somewhere in
> my backend something that would transform an array_type into a
> record_type but I did not find anything.
The comment should clearly state the intent of the change though and how to
adjust it to your needs.
--
Eric Botcazou