public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/51782] New: Missing address-space information leads to wrong code
Date: Sat, 07 Jan 2012 12:03:00 -0000	[thread overview]
Message-ID: <bug-51782-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 51782
           Summary: Missing address-space information leads to wrong code
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: addr-space, wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@atmel.com
            Target: avr


This is a bug with named address spaces trunk gcc 4.7 for the following source.

struct rgb { char r, g, b; };

char read_rgb_ok (const __pgm struct rgb *s)
{
    return s->r + s->g  + s->b;
}

char read_rgb_bug (const __pgm struct rgb *s)
{
    struct rgb t = *s;

    return t.r + t.g  + t.b;
}

Reading through *s must happen by means of LPM instructions (reading from
flash) and not by menas of LD instructions (reading from RAM).

However, the second function reads from RAM.


== Command Line ==

avr-gcc a-bug.c -S -Os -mmcu=avr4 -dp -fverbose-asm -v \
    -fdump-tree-optimized -fdump-tree-original -fdump-rtl-expand
-fdump-tree-gimple


== configure ==

Generated from 4.7.0 sources (HEAD) from 2012-01-03 SVN 182900

Target: avr
Configured with: ../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/local/gnu/install/gcc-4.7-mingw32 --host=i386-mingw32
--build=i686-linux-gnu --enable-languages=c,c++ --disable-nls --disable-shared
--disable-lto --disable-checking --disable-libquadmath --with-dwarf2
Thread model: single
gcc version 4.7.0 20120102 (experimental) (GCC)


             reply	other threads:[~2012-01-07 12:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-07 12:03 gjl at gcc dot gnu.org [this message]
2012-01-07 12:04 ` [Bug tree-optimization/51782] " gjl at gcc dot gnu.org
2012-01-07 12:06 ` gjl at gcc dot gnu.org
2012-01-07 12:08 ` gjl at gcc dot gnu.org
2012-01-07 12:10 ` gjl at gcc dot gnu.org
2012-01-07 12:11 ` gjl at gcc dot gnu.org
2012-01-07 12:12 ` gjl at gcc dot gnu.org
2012-01-07 12:17 ` gjl at gcc dot gnu.org
2012-01-09 12:05 ` rguenth at gcc dot gnu.org
2012-01-09 20:30 ` gjl at gcc dot gnu.org
2012-01-12 16:19 ` gjl at gcc dot gnu.org
2012-01-12 17:18 ` [Bug tree-optimization/51782] -ftree-sra: Missing address-space information leads to wrong jamborm at gcc dot gnu.org
2012-01-12 18:09 ` gjl at gcc dot gnu.org
2012-01-17 15:26 ` rguenth at gcc dot gnu.org
2012-01-18  9:34 ` gjl at gcc dot gnu.org
2012-01-25 19:18 ` gjl at gcc dot gnu.org
2012-02-17 13:06 ` jamborm at gcc dot gnu.org
2012-02-17 18:01 ` jamborm at gcc dot gnu.org
2012-02-17 18:52 ` jamborm at gcc dot gnu.org
2012-02-19 10:16 ` gjl at gcc dot gnu.org
2012-02-20  9:43 ` rguenther at suse dot de
2012-02-20 17:57 ` jamborm at gcc dot gnu.org
2012-02-20 20:15 ` rguenther at suse dot de
2012-02-21 10:14 ` gjl at gcc dot gnu.org
2012-02-21 10:41 ` [Bug middle-end/51782] " jamborm at gcc dot gnu.org
2012-02-21 10:41 ` jamborm at gcc dot gnu.org
2012-02-21 11:51 ` dominiq at lps dot ens.fr
2012-02-21 11:58 ` gjl at gcc dot gnu.org
2012-02-21 13:20 ` jamborm at gcc dot gnu.org
2012-02-22 10:55 ` jamborm at gcc dot gnu.org
2012-02-22 11:00 ` jamborm at gcc dot gnu.org

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-51782-4@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).