public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/42448]  New: Wrong code with _Complex char in structure
@ 2009-12-21 13:18 ubizjak at gmail dot com
  2009-12-21 13:19 ` [Bug target/42448] [4.3/4.4/4.5 Regression] " ubizjak at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2009-12-21 13:18 UTC (permalink / raw)
  To: gcc-bugs

Following testcase:

--cut here--
struct S2180
{
  char t;
  _Complex char u[2];
};

struct S2180 s2180;

int
main (void)
{
  volatile struct S2180 x;

  s2180.u[1] = 3 + 4i;

  x.u[1] = s2180.u[1];

  if (x.u[1] != s2180.u[1])
    abort ();

  return 0;
}
--cut here--

aborts for all optimization levels.

This bug shows in the testsuite of 4.4 branch [1]:

Running target unix
FAIL: tmpdir-gcc.dg-struct-layout-1/t024 c_compat_x_tst.o-c_compat_y_tst.o
execute 
FAIL: tmpdir-gcc.dg-struct-layout-1/t027 c_compat_x_tst.o-c_compat_y_tst.o
execute 

The bug is also present on 4.3 and 4.5.

[1] http://gcc.gnu.org/ml/gcc-testresults/2009-12/msg01241.html


-- 
           Summary: Wrong code with _Complex char in structure
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ubizjak at gmail dot com
 GCC build triplet: alpha-linux-gnu
  GCC host triplet: alpha-linux-gnu
GCC target triplet: alpha-linux-gnu


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
@ 2009-12-21 13:19 ` ubizjak at gmail dot com
  2009-12-21 19:36 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2009-12-21 13:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ubizjak at gmail dot com  2009-12-21 13:19 -------
Testsuite failure, so regression on all branches.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Priority|P3                          |P4
   Last reconfirmed|0000-00-00 00:00:00         |2009-12-21 13:19:36
               date|                            |
            Summary|Wrong code with _Complex    |[4.3/4.4/4.5 Regression]
                   |char in structure           |Wrong code with _Complex
                   |                            |char in structure
   Target Milestone|---                         |4.3.5


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
  2009-12-21 13:19 ` [Bug target/42448] [4.3/4.4/4.5 Regression] " ubizjak at gmail dot com
@ 2009-12-21 19:36 ` ubizjak at gmail dot com
  2009-12-23  9:57 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2009-12-21 19:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ubizjak at gmail dot com  2009-12-21 19:36 -------
This happens on !TARGET_BWX targets. Unaligned HImode access can cross widened
SImode boundaries. Following patch triggers on this invalid condition in
get_aligned_mem:

Index: alpha.c
===================================================================
--- alpha.c     (revision 155372)
+++ alpha.c     (working copy)
@@ -1475,6 +1475,10 @@ get_aligned_mem (rtx ref, rtx *paligned_
   else
     offset = disp & 3;

+  /* The location should not cross aligned word boundary.  */
+  gcc_assert (offset + GET_MODE_SIZE (GET_MODE (ref))
+             <= GET_MODE_SIZE (SImode));
+
   /* Access the entire aligned word.  */
   *paligned_mem = widen_memory_access (ref, SImode, -offset);



-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
  2009-12-21 13:19 ` [Bug target/42448] [4.3/4.4/4.5 Regression] " ubizjak at gmail dot com
  2009-12-21 19:36 ` ubizjak at gmail dot com
@ 2009-12-23  9:57 ` ubizjak at gmail dot com
  2010-01-02 14:19 ` uros at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2009-12-23  9:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2009-12-23 09:57 -------
Patch at http://gcc.gnu.org/ml/gcc-patches/2009-12/msg01067.html


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |ubizjak at gmail dot com
                   |dot org                     |
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2009-
                   |                            |12/msg01067.html
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2009-12-21 13:19:36         |2009-12-23 09:57:03
               date|                            |


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
                   ` (2 preceding siblings ...)
  2009-12-23  9:57 ` ubizjak at gmail dot com
@ 2010-01-02 14:19 ` uros at gcc dot gnu dot org
  2010-01-02 14:28 ` uros at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: uros at gcc dot gnu dot org @ 2010-01-02 14:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from uros at gcc dot gnu dot org  2010-01-02 14:18 -------
Subject: Bug 42448

Author: uros
Date: Sat Jan  2 14:18:41 2010
New Revision: 155566

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155566
Log:
        PR target/42448
        * config/alpha/predicates.md (aligned_memory_operand): Return false
        for CQImode.
        (unaligned_memory_operand): Return true for CQImode.
        * config/alpha/alpha.c (get_aligned_mem): Assert that location
        doesn not cross aligned SImode word boundary.

testsuite/ChangeLog:

        PR target/42448
        * gcc.target/alpha/pr42448-1.c: New test.
        * gcc.target/alpha/pr42448-2.c: Ditto.


Added:
    trunk/gcc/testsuite/gcc.target/alpha/pr42448-1.c
    trunk/gcc/testsuite/gcc.target/alpha/pr42448-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/alpha/alpha.c
    trunk/gcc/config/alpha/predicates.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
                   ` (3 preceding siblings ...)
  2010-01-02 14:19 ` uros at gcc dot gnu dot org
@ 2010-01-02 14:28 ` uros at gcc dot gnu dot org
  2010-01-02 14:32 ` uros at gcc dot gnu dot org
  2010-01-02 14:34 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: uros at gcc dot gnu dot org @ 2010-01-02 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from uros at gcc dot gnu dot org  2010-01-02 14:28 -------
Subject: Bug 42448

Author: uros
Date: Sat Jan  2 14:28:25 2010
New Revision: 155567

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155567
Log:
        PR target/42448
        * config/alpha/predicates.md (aligned_memory_operand): Return false
        for CQImode.
        (unaligned_memory_operand): Return true for CQImode.
        * config/alpha/alpha.c (get_aligned_mem): Assert that location
        doesn not cross aligned SImode word boundary.

testsuite/ChangeLog:

        PR target/42448
        * gcc.target/alpha/pr42448-1.c: New test.
        * gcc.target/alpha/pr42448-2.c: Ditto.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/alpha/pr42448-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.target/alpha/pr42448-2.c
Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/config/alpha/alpha.c
    branches/gcc-4_4-branch/gcc/config/alpha/predicates.md
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
                   ` (4 preceding siblings ...)
  2010-01-02 14:28 ` uros at gcc dot gnu dot org
@ 2010-01-02 14:32 ` uros at gcc dot gnu dot org
  2010-01-02 14:34 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: uros at gcc dot gnu dot org @ 2010-01-02 14:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from uros at gcc dot gnu dot org  2010-01-02 14:32 -------
Subject: Bug 42448

Author: uros
Date: Sat Jan  2 14:32:23 2010
New Revision: 155568

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155568
Log:
        PR target/42448
        * config/alpha/predicates.md (aligned_memory_operand): Return false
        for CQImode.
        (unaligned_memory_operand): Return true for CQImode.
        * config/alpha/alpha.c (get_aligned_mem): Assert that location
        doesn not cross aligned SImode word boundary.

testsuite/ChangeLog:

        PR target/42448
        * gcc.target/alpha/pr42448-1.c: New test.
        * gcc.target/alpha/pr42448-2.c: Ditto.


Added:
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/alpha/pr42448-1.c
    branches/gcc-4_3-branch/gcc/testsuite/gcc.target/alpha/pr42448-2.c
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config/alpha/alpha.c
    branches/gcc-4_3-branch/gcc/config/alpha/predicates.md


-- 


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/42448] [4.3/4.4/4.5 Regression] Wrong code with _Complex char in structure
  2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
                   ` (5 preceding siblings ...)
  2010-01-02 14:32 ` uros at gcc dot gnu dot org
@ 2010-01-02 14:34 ` ubizjak at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2010-01-02 14:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ubizjak at gmail dot com  2010-01-02 14:34 -------
Fixed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-01-02 14:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-21 13:18 [Bug target/42448] New: Wrong code with _Complex char in structure ubizjak at gmail dot com
2009-12-21 13:19 ` [Bug target/42448] [4.3/4.4/4.5 Regression] " ubizjak at gmail dot com
2009-12-21 19:36 ` ubizjak at gmail dot com
2009-12-23  9:57 ` ubizjak at gmail dot com
2010-01-02 14:19 ` uros at gcc dot gnu dot org
2010-01-02 14:28 ` uros at gcc dot gnu dot org
2010-01-02 14:32 ` uros at gcc dot gnu dot org
2010-01-02 14:34 ` ubizjak at gmail dot com

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).