public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jim Wilson <wilson@cygnus.com>
To: Alexandre Oliva <oliva@dcc.unicamp.br>
Cc: egcs@cygnus.com
Subject: Re: compile/961203-1.c
Date: Thu, 30 Oct 1997 11:56:00 -0000	[thread overview]
Message-ID: <199710301955.LAA16923@cygnus.com> (raw)
In-Reply-To: <or4t5zllz7.fsf@grupiara.dcc.unicamp.br>

Your patch is not correct.

You can't verify whether a size is negative by checking TREE_INT_CST_LOW.
Type sizes are stored as a pair of integers, and are negative only if
TREE_INT_CST_HIGH is negative.  Your patch will break 32 bit to 64 bit
cross compilation, because in such a case we need both integers to correctly
handle 64 bit type sizes, and it is easy for TREE_INT_CST_LOW to appear
to be negative when the entire value is not negative.  It isn't clear if
your patch will still if you check TREE_INT_CST_HIGH instead; I haven't
tried checking this.

Also, just because TREE_INT_CST_HIGH is negative does not mean that there
is a problem.  If you are cross compiling from a 32 bit host to a 64 bit
target, and you have a structure size which is very large, it could be
that TREE_INT_CST_HIGH will appear to be negative.  Gcc should not fail
for such a case.  Type sizes should be unsigned values, so ones that appear
to be negative should still be OK.

The proper way to handle this is to check whether a type size computation
resulted in an overflow.  In that case, and only in that case, gcc should fail.

We did try such a patch.  Unfortunately, this patch broke the Fortran front
end and had to be removed.  It turns out that the Fortran front end
intentionally generates an array large enough to cause a type size overflow.
We need to find a way to fix this problem, and then we can readd the type
size overflow error patch to fix the compile/961203-1.c problem.

Jim

      parent reply	other threads:[~1997-10-30 11:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-10-28 22:39 compile/961203-1.c Jeffrey A Law
1997-10-30  0:04 ` compile/961203-1.c Alexandre Oliva
1997-10-30  8:09   ` compile/961203-1.c Jeffrey A Law
1997-10-30 11:56   ` Jim Wilson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199710301955.LAA16923@cygnus.com \
    --to=wilson@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=oliva@dcc.unicamp.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).