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] |
Hello, Pure functions in Ada might raise and this doesn't match (any more) "const" functions in the middle-end, currently assumed to be SIDE_EFFECTS free, so ... 2008-08-01 Olivier Hainque <hainque@adacore.com> ada/ * decl.c (gnat_to_gnu_entity) <case E_Function>: Do not turn Ada Pure into GCC const, now implicitely implying nothrow as well. testsuite/ * gnat.dg/raise_from_pure.ad[bs], * gnat.dg/wrap_raise_from_pure.ad[bs]: Support for ... * gnat.dg/test_raise_from_pure.adb: New test. Otherwise, miscompilation of P at -O2 on at least x86_64-linux in the testcase below, not emitting the call to Raise_CE_if_0: with Raise_From_Pure; use Raise_From_Pure; procedure P is K : Integer; begin K := Raise_CE_If_0 (0); end; package raise_from_pure is pragma Pure; function Raise_CE_If_0 (P : Integer) return Integer; end; package body raise_from_pure is function Raise_CE_If_0 (P : Integer) return Integer is begin if P = 0 then raise Constraint_error; end if; return 1; end; end; Bootstrapped and regression tested on x86_64-suse-linux. Olivier
Attachment:
pure-noconst.dif
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |