This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/40933] New: Illegal program accepted, applying predefined operators of Integer on a derived type
- From: "ludovic at ludovic-brenta dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Aug 2009 14:43:26 -0000
- Subject: [Bug ada/40933] New: Illegal program accepted, applying predefined operators of Integer on a derived type
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following calls to predefined operators in Standard are all illegal but the
compiler only rejects 3 of them:
package pak1 is
type my_Int is new integer;
x1: my_int;
x2: my_int := standard."mod" (x1, 2);
x3: my_int := standard."rem" (x1, 2);
x4: my_int := standard."abs" (x1); -- line 7
x5: my_int := standard."+" (x1, 2);
x6: my_int := standard."-" (x1, 2);
x7: my_int := standard."*" (x1, 2);
x8: my_int := standard."/" (x1, 2);
x9: my_int := standard."+" (x1); -- line 12
x10: my_int := standard."-" (x1); -- line 13
end pak1;
gcc-4.3 -c pak1.ads
pak1.ads:7:26: "abs" not declared in "Standard"
pak1.ads:12:26: "+" not declared in "Standard"
pak1.ads:13:27: "-" not declared in "Standard"
gcc-4.4 -c pak1.ads
pak1.ads:7:26: "abs" not declared in "Standard"
pak1.ads:12:26: "+" not declared in "Standard"
pak1.ads:13:27: "-" not declared in "Standard"
It seems that, for all operators that take two operands, GCC silently (and
wrongly) converts x1 to its parent type, Integer. This does not happen for
unary operators.
--
Summary: Illegal program accepted, applying predefined operators
of Integer on a derived type
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ludovic at ludovic-brenta dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40933