diff mbox series

[Ada] Set Etype on rewriteen Max_Queue_Length expressions

Message ID 20180531104838.GA119712@adacore.com
State New
Headers show
Series [Ada] Set Etype on rewriteen Max_Queue_Length expressions | expand

Commit Message

Pierre-Marie de Rodat May 31, 2018, 10:48 a.m. UTC
Rewriting of Max_Queue_Length expression into N_Integer_Literal should probably
be done in expansion and not in analysis, but anyway it should not strip the
expression from its Etype because backends (e.g. GNATprove) expect that Etype
to be present.

No frontend test is provided, because GNAT doesn't care about the missing
Etype decoration. This patch allows to simplify AST processing in GNATprove.

Tested on x86_64-pc-linux-gnu, committed on trunk

2018-05-31  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

	* sem_prag.adb (Analyze_Pragma): Set Etype on the rewritten
	Max_Queue_Length expression.
diff mbox series

Patch

--- gcc/ada/sem_prag.adb
+++ gcc/ada/sem_prag.adb
@@ -18833,6 +18833,7 @@  package body Sem_Prag is
 
             if Nkind (Arg) /= N_Integer_Literal then
                Rewrite (Arg, Make_Integer_Literal (Sloc (Arg), Val));
+               Set_Etype (Arg, Etype (Original_Node (Arg)));
             end if;
 
             Record_Rep_Item (Entry_Id, N);