Bug 23427 - latent bug with array type size check
Summary: latent bug with array type size check
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.1.0
: P2 minor
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 24564
  Show dependency treegraph
 
Reported: 2005-08-16 18:53 UTC by Jim Wilson
Modified: 2005-11-10 02:46 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Untested patch for latent Ada front end bug. (537 bytes, patch)
2005-08-16 18:55 UTC, Jim Wilson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Wilson 2005-08-16 18:53:22 UTC
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.
Comment 1 Jim Wilson 2005-08-16 18:55:19 UTC
Created attachment 9506 [details]
Untested patch for latent Ada front end bug.
Comment 2 Laurent GUERBY 2005-08-16 19:12:54 UTC
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;
begin
   X := new A;
   Y := new A;
   Y.all := X.all;
end PP;
Comment 3 Arnaud Charlet 2005-09-06 14:42:32 UTC
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.

Arno
Comment 4 Laurent GUERBY 2005-11-03 15:49:32 UTC
I'm testing the patch aginst trunk, is it okay for 4.1 or should we wait after the branch?
Comment 5 Laurent Guerby 2005-11-03 22:13:07 UTC
Subject: Bug 23427

Author: guerby
Date: Thu Nov  3 22:13:03 2005
New Revision: 106452

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106452
Log:
2005-11-03  James E Wilson  <wilson@specifix.com>

	PR ada/23427
        * trans.c (gnat_to_gnu): Use TYPE_SIZE_UNIT not TYPE_SIZE in
        TREE_OVERFLOW check.


Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/trans.c

Comment 6 Laurent GUERBY 2005-11-03 22:14:24 UTC
Fixed