This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Conditional expression is static if all expression are static


This patch corrects an oversight in the initial implementation of
conditional expressions. The result is static if condition and both
sub-expressios are static (and result is selected expression). The
following test must compile silently with -gnatX.

function StaticCexpr (X : Long_Long_Float) return Long_Long_Float is
   Link_Prefix : constant String := "__builtin_";
   Link_Suffix : constant String :=
     (if Long_Long_Float'Size > Long_Float'Size then "l" else "");
   function C_Sin (X : Long_Long_Float) return Long_Long_Float;
   pragma Import (Intrinsic, C_Sin, Link_Prefix & "sin" & Link_Suffix);
begin
   return C_Sin (X);
end StaticCexpr;

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

2010-06-18  Robert Dewar  <dewar@adacore.com>

	* sem_eval.adb (Eval_Conditional_Expression): Result is static if
	condition and both sub-expressions are static (and result is selected
	expression).

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]