Since TYPE_SIZE was converted to use bitsizetype, which has extra bits of
precision, applying TREE_OVERFLOW to it is no longer useful. It does not
overflow when it should. We must use TYPE_SIZE_UNIT instead now. There is one
place in the Ada front end that has this problem.
I don't know enough about the Ada front end to construct a testcase to
demonstrate the problem.
I am also at the moment unable to build the Ada front end in order to prove that
my patch works.
See also PR 21105 (C front end) and PR 23426 (C++ front end) for related problems.
Created attachment 9506 [details]
Untested patch for latent Ada front end bug.
Even the following code doesn't trigger anything on x86-linux mainline, so I
assume the line in trans.c is unreachable. Richard Kenner might confirm here.
procedure PP is
subtype T is String (1 .. 1024 * 1024); -- 1 MBytes
type A is array (1 .. 513) of T; -- 513 MBytes > 2**32 bits
type P is access A;
X, Y : P;
X := new A;
Y := new A;
Y.all := X.all;
Patch looks good to me (and you should be able to test Ada now).
The code is there on "unexpected" cases anyway, so it's not surprising
that it is hard or even maybe impossible to trigger it.
I'm testing the patch aginst trunk, is it okay for 4.1 or should we wait after the branch?
Subject: Bug 23427
Date: Thu Nov 3 22:13:03 2005
New Revision: 106452
2005-11-03 James E Wilson <firstname.lastname@example.org>
* trans.c (gnat_to_gnu): Use TYPE_SIZE_UNIT not TYPE_SIZE in