public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bernd.edlinger at hotmail dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/58970] [4.7/4.8/4.9 Regression] internal compiler error: in get_bit_range, at expr.c:4562
Date: Tue, 05 Nov 2013 08:28:00 -0000	[thread overview]
Message-ID: <bug-58970-4-tZ2EylIWuF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58970-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58970

--- Comment #23 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
hmm...

all examples I can see, where bitpos is negative,
or less than the representative's bitoffset with offset=NULL,
are just blandtly invalid.

The only valid example would be

struct S { unsigned char s : 1; };
void function(struct S *p)
{
  p[-1].s = 0;
}

However this one is gimplified to

  D.1590 = p + -1;
  D.1590->s = 0;

no ARRAY_REFs at all, never.

Handling all that negative bitoffsets seems to be
a bit too much complication just to generate
valid code for invalid C.

At least returning negative bitoffset could be easily
avoided in get_inner_reference:

--- expr.c.jj    2013-10-31 14:57:05.000000000 +0100
+++ expr.c    2013-11-05 09:24:39.821624212 +0100
@@ -6708,7 +6708,7 @@
       tem = tem.sext (TYPE_PRECISION (sizetype));
       tem = tem.lshift (BITS_PER_UNIT == 8 ? 3 : exact_log2 (BITS_PER_UNIT));
       tem += bit_offset;
-      if (tem.fits_shwi ())
+      if (tem.fits_shwi () && !tem.is_negative ())
     {
       *pbitpos = tem.to_shwi ();
       *poffset = offset = NULL_TREE;


  parent reply	other threads:[~2013-11-05  8:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-02 10:16 [Bug middle-end/58970] New: " jan.smets@alcatel-lucent.com
2013-11-02 10:17 ` [Bug middle-end/58970] " jan.smets@alcatel-lucent.com
2013-11-02 13:38 ` [Bug middle-end/58970] [4.7/4.8/4.9 Regression] " mpolacek at gcc dot gnu.org
2013-11-03 19:16 ` bernd.edlinger at hotmail dot de
2013-11-04  0:56 ` jan.smets@alcatel-lucent.com
2013-11-04  8:41 ` jakub at gcc dot gnu.org
2013-11-04  9:00 ` bernd.edlinger at hotmail dot de
2013-11-04  9:31 ` jakub at gcc dot gnu.org
2013-11-04  9:32 ` jakub at gcc dot gnu.org
2013-11-04  9:54 ` bernd.edlinger at hotmail dot de
2013-11-04 10:01 ` jakub at gcc dot gnu.org
2013-11-04 10:07 ` bernd.edlinger at hotmail dot de
2013-11-04 10:12 ` jakub at gcc dot gnu.org
2013-11-04 10:32 ` bernd.edlinger at hotmail dot de
2013-11-04 11:07 ` bernd.edlinger at hotmail dot de
2013-11-04 11:30 ` jakub at gcc dot gnu.org
2013-11-04 11:46 ` bernd.edlinger at hotmail dot de
2013-11-04 12:10 ` bernd.edlinger at hotmail dot de
2013-11-04 12:15 ` jakub at gcc dot gnu.org
2013-11-04 14:28 ` rguenth at gcc dot gnu.org
2013-11-04 16:02 ` jakub at gcc dot gnu.org
2013-11-04 17:55 ` ebotcazou at gcc dot gnu.org
2013-11-05  8:28 ` bernd.edlinger at hotmail dot de [this message]
2013-11-05 19:37 ` bernd.edlinger at hotmail dot de
2013-11-06  7:50 ` jakub at gcc dot gnu.org
2013-11-06 14:11 ` jan.smets@alcatel-lucent.com
2013-11-11  7:57 ` jakub at gcc dot gnu.org
2013-11-11  9:41 ` jan.smets@alcatel-lucent.com
2013-11-19 13:33 ` [Bug middle-end/58970] [4.7 " rguenth at gcc dot gnu.org
2014-04-23 12:39 ` jan.smets@alcatel-lucent.com

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=bug-58970-4-tZ2EylIWuF@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).