ada: Don't reuse operator nodes in expansion
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 2 Sep 2022 20:42:57 +0000 (22:42 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 7 Nov 2022 08:36:30 +0000 (09:36 +0100)
commit03b4e4ae3b0d647a44c3dac09e27ab4151a84e85
treee45f07121e885bd9420ca01ecb3a501e2c4802aa
parentffe889d7ffcc7e8150413d4de38e066940fb7881
ada: Don't reuse operator nodes in expansion

This patch removes handling of references to unset objects that relied
on Original_Node. This handling was only needed because of rewriting
that reused operator nodes, for example, when an array inequality like:

  A < B

was rewritten into:

  System.Compare_Array_Unsigned_8.Compare_Array_U8
    (A'Address, B'Address, A'Length, B'Length) < 0

by keeping the node for operator "<" and only substituting its operands.
It seems safer to simply create an new operator node when rewriting and
not rely on Original_Node afterwards.

Cleanup related to improved detection uninitialized objects.

gcc/ada/

* checks.adb (Apply_Arithmetic_Overflow_Strict): Rewrite using a
newly created operator node.
* exp_ch4.adb (Expand_Array_Comparison): Likewise.
* exp_ch6.adb (Add_Call_By_Copy_Code): Rewriting actual parameter
using its own location and not the location of the subprogram
call.
* sem_warn.adb (Check_References): Looping with Original_Node is
no longer needed.
gcc/ada/checks.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch6.adb
gcc/ada/sem_warn.adb