public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
@ 2014-01-05  1:57 nullnilaki at gmail dot com
  2014-01-05 20:57 ` [Bug target/59679] " nullnilaki at gmail dot com
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-05  1:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59679
           Summary: gcc version 4.7.3 and gcc version 4.5.3 cause an
                    unaligned access exception on NetBSD/Alpha
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nullnilaki at gmail dot com

Using gcc4.7.3 and gcc4.5.3 to compile a Perl v5.18.1.
Perl cause an unaligned access exception.
----------------------------------------------------------------

Please read the perl-bug
https://rt.perl.org/Public/Bug/Display.html?id=120888

----------------------------------------------------------------

gcc4.5 and gcc4.7 cause this problem.
(I can not compile gcc4.6 and gcc4.8 but I think gcc4.6 and gcc4.8 has some 
kind of similar bug.)

----------------------------------------------------------------

This problem was caused by compiler's bug. -ftree-ter option makes wrong
binary. 

----------------------------------------------------------------

-O2 version.

(gdb) break scope.c:1217
No source file named scope.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (scope.c:1217) pending.
(gdb) r perl.pl
Starting program: /usr/pkg/bin/perl perl.pl
[Switching to LWP 1]

Breakpoint 1, Perl_leave_scope (my_perl=0x160505000, base=<optimized out>) at 
scope.c:1217
1217                *(I8*)ARG0_PTR = (I8)(uv >> 8);
(gdb) list
1212    
1213            case SAVEt_I16:                         /* I16 reference */
1214                *(I16*)ARG0_PTR = (I16)(uv >> 8);
1215                break;
1216            case SAVEt_I8:                          /* I8 reference */
1217                *(I8*)ARG0_PTR = (I8)(uv >> 8);
1218                break;
1219            case SAVEt_DESTRUCTOR:
1220                (*arg1.any_dptr)(ARG0_PTR);
1221                break;
(gdb) x/10i $pc
=> 0x1601795c0 <Perl_leave_scope+3648>: extbl   t5,0x1,t5
   0x1601795c4 <Perl_leave_scope+3652>: ldl     t0,0(s1)
   0x1601795c8 <Perl_leave_scope+3656>: andnot  t0,0xff,t0
   0x1601795cc <Perl_leave_scope+3660>: or      t5,t0,t5
   0x1601795d0 <Perl_leave_scope+3664>: stl     t5,0(s1)
   0x1601795d4 <Perl_leave_scope+3668>: ldl     t3,48(s0)
   0x1601795d8 <Perl_leave_scope+3672>: ldl     t0,152(s0)
   0x1601795dc <Perl_leave_scope+3676>: br      0x160178800 
<Perl_leave_scope+128>
   0x1601795e0 <Perl_leave_scope+3680>: mov     s0,a0
   0x1601795e4 <Perl_leave_scope+3684>: ldq     t12,-24984(gp)
(gdb) p uv
$1 = 2574
(gdb) ptype uv
type = long unsigned int
(gdb) ptype I8
type = signed char
(gdb) print /a uv
$2 = 0xa0e
(gdb) p arg0
$1 = {any_ptr = 0x1605104ee, any_i32 = 1615922414, any_iv = 5910889710, any_uv 
= 5910889710, any_long = 5910889710, any_bool = 238, 
  any_dptr = 0x1605104ee, any_dxptr = 0x1605104ee}
(gdb) p &arg0
Address requested for identifier "arg0" which is in register $s1
(gdb) n
pid 436 (perl): unaligned access: va=0x1605104ee pc=0x1601795c4 ra=0x160179124 
sp=0x1ffffc698 op=ldl
pid 436 (perl): unaligned access: va=0x1605104ee pc=0x1601795d0 ra=0x160179124 
sp=0x1ffffc698 op=stl
1218                break;
1218                break;
(gdb) p uv
$1 = <optimized out>

-------------------------------------------------------------------

-O2 -fno-tree-ter version.

(gdb) break scope.c:1217
No source file named scope.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (scope.c:1217) pending.
(gdb) r perl.pl
Starting program: /usr/pkg/bin/perl perl.pl
[Switching to LWP 1]

Breakpoint 1, Perl_leave_scope (my_perl=0x160505000, base=<optimized out>) at 
scope.c:1217
1217                *(I8*)ARG0_PTR = (I8)(uv >> 8);
(gdb) x/10i $pc
=> 0x160177df0 <Perl_leave_scope+3664>: extbl   t5,0x1,t5
   0x160177df4 <Perl_leave_scope+3668>: ldq_u   t0,0(s1)
   0x160177df8 <Perl_leave_scope+3672>: insbl   t5,s1,t5
   0x160177dfc <Perl_leave_scope+3676>: mskbl   t0,s1,t0
   0x160177e00 <Perl_leave_scope+3680>: or      t5,t0,t5
   0x160177e04 <Perl_leave_scope+3684>: stq_u   t5,0(s1)
   0x160177e08 <Perl_leave_scope+3688>: ldl     t3,48(s0)
   0x160177e0c <Perl_leave_scope+3692>: ldl     t0,152(s0)
   0x160177e10 <Perl_leave_scope+3696>: br      0x160177020 
<Perl_leave_scope+128>
   0x160177e14 <Perl_leave_scope+3700>: unop    
(gdb) p uv
$1 = 2574
(gdb) ptype uv
type = long unsigned int
(gdb) ptype I8
type = signed char
(gdb) print /a uv
$2 = 0xa0e
(gdb) p arg0
$1 = {any_ptr = 0x1605104ee, any_i32 = 1615922414, any_iv = 5910889710, any_uv 
= 5910889710, any_long = 5910889710, any_bool = 238, 
  any_dptr = 0x1605104ee, any_dxptr = 0x1605104ee}
(gdb) n
1218                break;


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
@ 2014-01-05 20:57 ` nullnilaki at gmail dot com
  2014-01-05 20:57 ` nullnilaki at gmail dot com
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-05 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from nullnilaki at gmail dot com ---
Created attachment 31576
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31576&action=edit
perl.h

perl.h


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
  2014-01-05 20:57 ` [Bug target/59679] " nullnilaki at gmail dot com
@ 2014-01-05 20:57 ` nullnilaki at gmail dot com
  2014-01-05 21:02 ` nullnilaki at gmail dot com
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-05 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from nullnilaki at gmail dot com ---
Created attachment 31577
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31577&action=edit
scope.c

scope.c


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
  2014-01-05 20:57 ` [Bug target/59679] " nullnilaki at gmail dot com
  2014-01-05 20:57 ` nullnilaki at gmail dot com
@ 2014-01-05 21:02 ` nullnilaki at gmail dot com
  2014-01-05 23:08 ` pinskia at gcc dot gnu.org
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-05 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from nullnilaki at gmail dot com ---
(In reply to Andrew Pinski from comment #1)
> This looks more like a bug in perl sources.  Can you attach the preprocessed
> source for scope.c?
> 
> The big question is how is ARG0_PTR defined?  GCC must be assuming the
> alignment is 64bits for some reason.  This needs the preprocessed source to
> see why the alignment is being done incorrectly.  Maybe ARG0_PTR was
> assigned from a long long pointer. 
> 
> In C, once you assign it to a pointer of bigger alignment and it is not
> aligned, the code is undefined.

Thank you for your reply!

ARG0_PTR is defined in scope.c.
#define ARG0_PTR arg0.any_ptr

and

any_ptr is defined in perl.h.

union any {
    void*       any_ptr;
    I32         any_i32;
    IV          any_iv;
    UV          any_uv;
    long        any_long;
    bool        any_bool;
    void        (*any_dptr) (void*);
    void        (*any_dxptr) (pTHX_ void*);
};


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (2 preceding siblings ...)
  2014-01-05 21:02 ` nullnilaki at gmail dot com
@ 2014-01-05 23:08 ` pinskia at gcc dot gnu.org
  2014-01-06 16:01 ` nullnilaki at gmail dot com
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-01-05 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is still not the preprocessed source.  We need the preprocessed source and
the exact options you used to compile the source and the exact options used to
configure gcc with.


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (3 preceding siblings ...)
  2014-01-05 23:08 ` pinskia at gcc dot gnu.org
@ 2014-01-06 16:01 ` nullnilaki at gmail dot com
  2014-01-06 16:32 ` nullnilaki at gmail dot com
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-06 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from nullnilaki at gmail dot com ---
(In reply to Andrew Pinski from comment #5)
> This is still not the preprocessed source.  We need the preprocessed source
> and the exact options you used to compile the source and the exact options
> used to configure gcc with.

Thank you for your reply!
>We need the preprocessed source...
I made a mistake.
Sorry...
--------------------------------------------------------------
Compile option.

[*] /usr/pkgsrc/lang/perl5/work/.wrapper/bin/cc
/usr/pkgsrc/lang/perl5/work/.wrapper/bin/cc -c -DPERL_CORE -O2 -mieee -pthread
-I/usr/include -fno-strict-aliasing -pipe -
I/usr/pkg/include -std=c89 -O2 -mieee -pthread -I/usr/include -Wall -ansi -W
-Wextra -Wdeclaration-after-statement -Wendif-labels -Wc++-compat
-Wwrite-strings -DPIC -fPIC
 scope.c
WARNING: [transform-gcc] passing unknown option -mieee
WARNING: [transform-gcc] passing unknown option -std=c89
WARNING: [transform-gcc] passing unknown option -mieee
WARNING: [transform-gcc] passing unknown option -ansi
WARNING: [transform-gcc] passing unknown option -Wdeclaration-after-statement
WARNING: [transform-gcc] passing unknown option -Wendif-labels
WARNING: [transform-gcc] passing unknown option -Wc++-compat
<.> /usr/pkgsrc/lang/perl5/work/.gcc/bin/gcc -c -DPERL_CORE -O2 -mieee -pthread
-fno-strict-aliasing -pipe -I/usr/pkgsrc/lang/perl5/work/.buildlink/include
-std=c89 -O2 -
mieee -pthread -Wall -ansi -W -Wextra -Wdeclaration-after-statement
-Wendif-labels -Wc++-compat -Wwrite-strings -DPIC -fPIC scope.c
-L/usr/pkgsrc/lang/perl5/work/.buildli
nk/lib

--------------------------------------------------------------


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (4 preceding siblings ...)
  2014-01-06 16:01 ` nullnilaki at gmail dot com
@ 2014-01-06 16:32 ` nullnilaki at gmail dot com
  2014-01-06 16:56 ` nullnilaki at gmail dot com
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-06 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from nullnilaki at gmail dot com ---
Created attachment 31756
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31756&action=edit
preprocess scope.c(NO.1)

preprocess scope.c(This source is very large. Please concatenate files.)


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (5 preceding siblings ...)
  2014-01-06 16:32 ` nullnilaki at gmail dot com
@ 2014-01-06 16:56 ` nullnilaki at gmail dot com
  2014-01-06 16:57 ` nullnilaki at gmail dot com
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-06 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from nullnilaki at gmail dot com ---
Created attachment 31757
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31757&action=edit
preprocess scope.c(NO.2)

preprocess scope.c(This source is very large. Please concatenate files.)


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (6 preceding siblings ...)
  2014-01-06 16:56 ` nullnilaki at gmail dot com
@ 2014-01-06 16:57 ` nullnilaki at gmail dot com
  2014-01-26 22:56 ` mcree at orcon dot net.nz
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: nullnilaki at gmail dot com @ 2014-01-06 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from nullnilaki at gmail dot com ---
Created attachment 31758
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31758&action=edit
preprocess scope.c(NO.3)

preprocess scope.c(This source is very large. Please concatenate files.)


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (7 preceding siblings ...)
  2014-01-06 16:57 ` nullnilaki at gmail dot com
@ 2014-01-26 22:56 ` mcree at orcon dot net.nz
  2014-01-26 23:00 ` mcree at orcon dot net.nz
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: mcree at orcon dot net.nz @ 2014-01-26 22:56 UTC (permalink / raw)
  To: gcc-bugs

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

Michael Cree <mcree at orcon dot net.nz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mcree at orcon dot net.nz

--- Comment #10 from Michael Cree <mcree at orcon dot net.nz> ---
This misaligned access in perl is also seen on Debian Alpha Linux. I have been
able to reduce the scope.c file substantially while maintaining the misaligned
access.  I will attach that as scope-reduced.c.

The misaligned access occurs in line 60, being the case SAVEt_I8 of the switch
statement, and with -O2 compiles to:

        extbl $4,1,$4
$LVL18:
        ldl $1,0($6)
        bic $1,255,$1
        bis $4,$1,$4
        stl $4,0($6)

Thus there is an assumption that ARG0_PTR (which expands to arg0.any_ptr)
points to an address at least divisible by four.

If one compiles with -fno-tree-ter as mentioned in the initial bug report then
one gets:

        sll $5,48,$5
$LVL18:
        ldq_u $1,0($4)
        sra $5,56,$5
        mskbl $1,$4,$1
        insbl $5,$4,$5
        bis $5,$1,$5
        stq_u $5,0($4)

which copes with any alignment.

If either of the cases SAVEt_SAVESWITCHSTACK or SAVEt_SET_SVFLAGS is removed
from the switch statement then the ldq_u/mskbl/insbl sequence results. Thus
there appears to be some interaction between those two cases and the code at
the top of the while statement that the compiler is using to determine that
ARG0_PTR points to an address at least divisible by four.  I admit that I have
so far failed to see how such an inference can be made but look forward to
being educated by the erudite gcc maintainers.

Compilation was done with:

cc -DPERL_CORE  -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -D_FORTIFY_SOURCE=2 -g -O2
-v -S scope-reduced.c
Using built-in specs.
COLLECT_GCC=cc
Target: alpha-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.8.2-13'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libssp
--disable-libmudflap --disable-libitm --disable-libsanitizer
--disable-libquadmath --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-alpha/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-alpha
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-alpha
--with-arch-directory=alpha --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-long-double-128
--enable-checking=release --build=alpha-linux-gnu --host=alpha-linux-gnu
--target=alpha-linux-gnu
Thread model: posix
gcc version 4.8.2 (Debian 4.8.2-13) 
COLLECT_GCC_OPTIONS='-D' 'PERL_CORE' '-D' '_REENTRANT' '-D' '_GNU_SOURCE' '-D'
'DEBIAN' '-D' '_FORTIFY_SOURCE=2' '-g' '-O2' '-v' '-S'
 /usr/lib/gcc/alpha-linux-gnu/4.8/cc1 -quiet -v -imultilib . -imultiarch
alpha-linux-gnu -D PERL_CORE -D _REENTRANT -D _GNU_SOURCE -D DEBIAN -D
_FORTIFY_SOURCE=2 scope-reduced.c -quiet -dumpbase scope-reduced.c -auxbase
scope-reduced -g -O2 -version -o scope-reduced.s
GNU C (Debian 4.8.2-13) version 4.8.2 (alpha-linux-gnu)
    compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/alpha-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/alpha-linux-gnu/4.8/../../../../alpha-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/alpha-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/alpha-linux-gnu/4.8/include-fixed
 /usr/include/alpha-linux-gnu
 /usr/include
End of search list.
GNU C (Debian 4.8.2-13) version 4.8.2 (alpha-linux-gnu)
    compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2-p3,
MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 503630c10eca9d1ddabc1e36fce68a5f
COMPILER_PATH=/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/:/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/alpha-linux-gnu/4.8/:/usr/lib/gcc/alpha-linux-gnu/4.8/../../../alpha-linux-gnu/:/usr/lib/gcc/alpha-linux-gnu/4.8/../../../:/lib/alpha-linux-gnu/:/lib/:/usr/lib/alpha-linux-gnu/:/usr/lib/
COLLECT_GCC_OPTIONS='-D' 'PERL_CORE' '-D' '_REENTRANT' '-D' '_GNU_SOURCE' '-D'
'DEBIAN' '-D' '_FORTIFY_SOURCE=2' '-g' '-O2' '-v' '-S'

I will also attach preprocessed source.


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (8 preceding siblings ...)
  2014-01-26 22:56 ` mcree at orcon dot net.nz
@ 2014-01-26 23:00 ` mcree at orcon dot net.nz
  2014-01-26 23:01 ` mcree at orcon dot net.nz
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: mcree at orcon dot net.nz @ 2014-01-26 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Michael Cree <mcree at orcon dot net.nz> ---
Created attachment 31957
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31957&action=edit
Reduced version of scope.c illustrating problem.


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

* [Bug target/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (9 preceding siblings ...)
  2014-01-26 23:00 ` mcree at orcon dot net.nz
@ 2014-01-26 23:01 ` mcree at orcon dot net.nz
  2014-01-28 16:54 ` [Bug tree-optimization/59679] " ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: mcree at orcon dot net.nz @ 2014-01-26 23:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Michael Cree <mcree at orcon dot net.nz> ---
Created attachment 31958
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31958&action=edit
Preprocessed version of scope-reduced.c


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

* [Bug tree-optimization/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (10 preceding siblings ...)
  2014-01-26 23:01 ` mcree at orcon dot net.nz
@ 2014-01-28 16:54 ` ubizjak at gmail dot com
  2014-01-28 17:17 ` ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2014-01-28 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|target                      |tree-optimization
   Target Milestone|---                         |4.7.4

--- Comment #13 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed as tree-optimization problem on 4.9 branch.

The compiler was build as a crosscompiler from x86_64-linux-gnu to
alpha-linux-gnu, configured with "configure --target=alpha-linux-gnu".

The preprocessed source from comment 12 is compiled with:

a) gcc-build-alpha/gcc/cc1 -O2 -fno-tree-ter -fpreprocessed
scope-reduced-preprocessed.c
b) gcc-build-alpha/gcc/cc1 -O2 -fpreprocessed scope-reduced-preprocessed.c

where a) creates correct binary (scope-reduced.s) and b) creates wrong binary
(scope-reduced_.s).

The difference between scope-reduced.s (correct) and scope-reduced_.s (wrong):

--- scope-reduced.s     2014-01-28 17:45:07.803092987 +0100
+++ scope-reduced_.s    2014-01-28 17:44:50.365312704 +0100
@@ -16,7 +16,7 @@
 $Perl_leave_scope..ng:
        lda $30,-16($30)
        cpys $f31,$f31,$f31
-       mov $31,$5
+       mov $31,$6
        ldl $1,48($16)
        mov $31,$8
        stq $26,0($30)
@@ -33,10 +33,10 @@
        s8addq $2,$1,$1
        ldq $3,0($1)
        and $3,63,$18
-       cmpule $18,4,$6
-       bne $6,$L3
+       cmpule $18,4,$5
+       bne $5,$L3
        cmpule $18,20,$2
-       ldq $5,-8($1)
+       ldq $6,-8($1)
        beq $2,$L4
        lda $2,-8($1)
 $L5:
@@ -65,14 +65,12 @@
        br $31,$L5
        .align 4
 $L17:
-       sll $3,48,$3
-       ldq_u $1,0($5)
-       sra $3,56,$3
-       mskbl $1,$5,$1
-       insbl $3,$5,$3
+       extbl $3,1,$3
+       ldl $1,0($6)
+       bic $1,255,$1
        cpys $f31,$f31,$f31
        bis $3,$1,$3
-       stq_u $3,0($5)
+       stl $3,0($6)
        ldl $1,48($16)
        cmplt $17,$1,$2
        bne $2,$L12
@@ -84,24 +82,24 @@
 $L9:
        ldl $2,12($8)
        ldl $1,48($16)
-       bis $5,$2,$2
+       bis $6,$2,$2
        stl $2,12($8)
        br $31,$L2
        .align 4
 $L8:
        ldq $3,0($16)
        ldq $22,24($16)
-       ldq $4,0($5)
+       ldq $4,0($6)
        bis $31,$31,$31
        mov $2,$1
-       ldq $6,0($7)
+       ldq $5,0($7)
        subq $3,$22,$2
        cpys $f31,$f31,$f31
        sra $2,3,$2
        stq $2,16($4)
        ldq $4,16($7)
-       ldq $3,24($6)
-       ldq $2,16($6)
+       ldq $3,24($5)
+       ldq $2,16($5)
        stq $4,24($16)
        s8addq $3,$4,$3
        stq $7,184($16)

The problem can be seen just after $L17 label.
>From gcc-bugs-return-441770-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 16:59:36 2014
Return-Path: <gcc-bugs-return-441770-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6231 invoked by alias); 28 Jan 2014 16:59:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 6199 invoked by uid 48); 28 Jan 2014 16:59:33 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59968] Unused BT patterns
Date: Tue, 28 Jan 2014 16:59:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59968-4-dUREX0yVxt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59968-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59968-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02912.txt.bz2
Content-length: 456

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY968

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> ---
For

int
__attribute__((noinline))
foo1 (int x, int y)
{
  x &= (1 << y);
  return x != 0;
}

we generate

    movl    %esi, %ecx
    movl    $1, %eax
    sall    %cl, %eax
    testl    %edi, %eax
    setne    %al
    movzbl    %al, %eax
    ret

I am expecting:

    bt      %esi, %edi
    setc    %al
        movzbl    %al, %eax
        ret


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

* [Bug tree-optimization/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (11 preceding siblings ...)
  2014-01-28 16:54 ` [Bug tree-optimization/59679] " ubizjak at gmail dot com
@ 2014-01-28 17:17 ` ubizjak at gmail dot com
  2014-01-28 18:25 ` [Bug middle-end/59679] " ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2014-01-28 17:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Uroš Bizjak <ubizjak at gmail dot com> ---
There is no differences in .optimized tree dumps.
>From gcc-bugs-return-441774-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 17:43:50 2014
Return-Path: <gcc-bugs-return-441774-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 25818 invoked by alias); 28 Jan 2014 17:43:50 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 25788 invoked by uid 48); 28 Jan 2014 17:43:46 -0000
From: "janus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/59941] [4.7 Regression] [OOP] ICE with polymorphic types
Date: Tue, 28 Jan 2014 17:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.7.4
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: janus at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59941-4-FZoHB0Xu5C@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59941-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59941-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02916.txt.bz2
Content-length: 1585

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

--- Comment #10 from janus at gcc dot gnu.org ---
(In reply to janus from comment #8)
> Backtrace from gdb:
> 
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004d19d6 in replace_comp (expr=expr@entry=0x146cc10,
> sym=sym@entry=0x146f7a0, i=i@entry=0x7fffffffdc6c)
>     at /home/jweil/gcc47/branch/gcc/fortran/expr.c:4199
> 4199		   && !gfc_is_intrinsic (expr->symtree->n.sym, 0, expr->where)))
> (gdb) bt
> #0  0x00000000004d19d6 in replace_comp (expr=expr@entry=0x146cc10,
> sym=sym@entry=0x146f7a0, i=i@entry=0x7fffffffdc6c)
>     at /home/jweil/gcc47/branch/gcc/fortran/expr.c:4199

Here in replace_comp, the sym is 'get_smatrix', and the problem is that
expr->symtree is NULL.


> #1  0x00000000004d46ba in gfc_traverse_expr (expr=0x146cc10,
> sym=sym@entry=0x146f7a0, 
>     func=func@entry=0x4d19a0 <replace_comp>, f=f@entry=0) at
> /home/jweil/gcc47/branch/gcc/fortran/expr.c:3929
> #2  0x00000000004d6c9c in gfc_expr_replace_comp (expr=<optimized out>,
> dest=dest@entry=0x146f7a0)
>     at /home/jweil/gcc47/branch/gcc/fortran/expr.c:4218
> #3  0x0000000000524615 in resolve_fl_derived0 (sym=sym@entry=0x146e590)
>     at /home/jweil/gcc47/branch/gcc/fortran/resolve.c:11724
> #4  0x000000000052c80d in resolve_fl_derived (sym=sym@entry=0x146e590)
>     at /home/jweil/gcc47/branch/gcc/fortran/resolve.c:12046

In here the sym is '__vtype_beam_structures_Beam_structure_t' (the vtabs and
vtypes are always imported when loading a module).
>From gcc-bugs-return-441775-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 17:44:54 2014
Return-Path: <gcc-bugs-return-441775-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26629 invoked by alias); 28 Jan 2014 17:44:54 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26597 invoked by uid 48); 28 Jan 2014 17:44:49 -0000
From: "Denis.V.Kolesnik@safe-mail.net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/59598] very simple code using file open for read
Date: Tue, 28 Jan 2014 17:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.6.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: blocker
X-Bugzilla-Who: Denis.V.Kolesnik@safe-mail.net
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-59598-4-6zzkJckcyH@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59598-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59598-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02917.txt.bz2
Content-length: 5326

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

Denis Kolesnik <Denis.V.Kolesnik@safe-mail.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #34 from Denis Kolesnik <Denis.V.Kolesnik@safe-mail.net> ---
// a small text file filter.c //

#include <stdio.h>





main(int argc, char* argv[])

{


    char c, previous_c;       

    int word_begin_position[3000];


    //int spec_symbol[7]={0xAE,0xBB,0xAB,0xA9,0x22,0x2F,0x27};


    //int eof_symbol[2]={0x0D,0x0A};
    int search_result;

    int this_is_the_same_word;
    int words_count;
    int word_number;

    int search_result_A_count;
    int search_result_space;

    FILE *stream,*stream2;


    int i, j, characters_count, character_number;
    int other_character_printed;


    // double characters
    int A_count, E_count;



    characters_count=0;    

    stream = fopen (argv[1],"r");

    while ((c = fgetc(stream)) != EOF) 

    {    
        characters_count++;

    }
    fclose(stream);
    //printf("total characters are %i\n", characters_count); 


    character_number=1;
    words_count=0;
    previous_c=0;


    stream = fopen (argv[1],"r");

    while ((c = fgetc(stream)) != EOF) 

    {
        if(((c!=0x20) && (character_number==1)) || ((previous_c==0x20) &&
(c!=0x20) && (c!=0x0A)) || ((previous_c!=0x20) && (c==0x0D)) || ((c!=0x20) &&
(c!=0x0D) && (c!=0x0A) && (previous_c==0x0A)) || ((previous_c!=0x20) &&
(previous_c!=0x0A) && (character_number==characters_count) && (c==0x20)))

//        1. ((c!=0x20) && (character_number==1))
//        2. ((previous_c==0x20) && (c!=0x20) && (c!=0x0A))
//        3. ((previous_c!=0x20) && (c==0x0D))
//        !((previous_c!=0x0D) && (c==0x0A))
//        4. ((c!=0x20) && (c!=0x0D) && (c!=0x0A) && (previous_c==0x0A))
//        5. ((previous_c!=0x20) && (previous_c!=0x0A) &&
(character_number==characters_count) && (c==0x20))

            this_is_the_same_word=0;
        else
            this_is_the_same_word=1;

        if(this_is_the_same_word==0)
        {
            words_count++;            
            word_begin_position[words_count]=character_number;

            //printf(" the begin char is .....
%i",word_begin_position[words_count]);
        }

    //if(character_number==characters_count)
    //    printf("the last character");
/*
    printf(" the number of words is %i\n", words_count);
    printf(" the current character is ..... %c\n", c);
    if(c==0x0D)
        printf(" the current character is ..... 0x0D\n");
    if(c==0x0A)
        printf(" the current character is ..... 0x0A\n");
*/
        previous_c=c;
        character_number++;
    }
    fclose(stream);



    word_number=1;    
    character_number=1;

    A_count=1;
    E_count=1;

    stream = fopen (argv[1],"r");

    //stream2 = fopen (argv[2],"w");

    while ((c = fgetc(stream)) != EOF) 

    {    

        other_character_printed=0;
        if(words_count>=2)
        if(word_number<words_count-1)
        if((character_number >= word_begin_position[word_number]) &&
(character_number < word_begin_position[word_number+1]))
        {
            A_count=1;
            E_count=1;

            word_number++;
        }

        //printf("\n the word begin position
%i\n",word_begin_position[word_number]);
        //printf("\n1 char is %i\n", character_number);
        //printf("\nthe words count is %i\n", words_count);

        // A
        if((other_character_printed==0) && ((c=='a') || (c=='а') || (c=='A') ||
(c=='А')) )
        if(A_count==1)
        {
            printf("A1");
            A_count=2;
            other_character_printed=1;
        }
        else
        {
            printf("A2");
            A_count=1;
            other_character_printed=1;
        }
        else
        if((other_character_printed==0) && ((c!='е') && (c!='e') && (c!='Е') &&
(c!='E')))
        {
            printf("%c", c);
            other_character_printed=1;
        }

        // E
        if((other_character_printed==0) && ((c=='e') || (c=='е') || (c=='E') ||
(c=='Е')) )
        if(E_count==1)
        {
            printf("E1");
            E_count=2;
            other_character_printed=1;
        }
        else
        {
            printf("E2");
            E_count=1;
            other_character_printed=1;
        }
        else
        if((other_character_printed==0) && ((c!='a') && (c!='а') && (c!='А') &&
(c!='A')))
        {
            printf("%c", c);
            other_character_printed=1;
        }


        //if(c=='0')
        //{
        //    printf("%c", c);
        //    other_character_printed=1;
        //}


        character_number++;
    }
    fclose(stream);
    //printf(" the number of words is %i", words_count);



    return 0;

}
>From gcc-bugs-return-441776-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 17:45:47 2014
Return-Path: <gcc-bugs-return-441776-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27582 invoked by alias); 28 Jan 2014 17:45:46 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27547 invoked by uid 48); 28 Jan 2014 17:45:43 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59968] Unused BT patterns
Date: Tue, 28 Jan 2014 17:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59968-4-WdiOyUVaVw@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59968-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59968-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02918.txt.bz2
Content-length: 501

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY968

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
For

int
__attribute__((noinline))
foo1 (int x, int y)
{
  int z;
  z = x & (1 << y);
  x |= 1 << y;
  x &= ~z;
  return x;
}

we generate:

    movl    %esi, %ecx
    movl    $1, %edx
    sall    %cl, %edx
    movl    %edx, %eax
    orl    %edi, %eax
    andl    %edx, %edi
    notl    %edi
    andl    %edi, %eax
    ret

I expect:
    movl    %edi, %eax
    btc     %esi, %eax
    ret


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

* [Bug middle-end/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (12 preceding siblings ...)
  2014-01-28 17:17 ` ubizjak at gmail dot com
@ 2014-01-28 18:25 ` ubizjak at gmail dot com
  2014-01-29 16:39 ` ubizjak at gmail dot com
  2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2014-01-28 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |middle-end

--- Comment #15 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #13)
> Confirmed as tree-optimization problem on 4.9 branch.

Actually, a middle-end problem, if at all. With -ftree-ter, expand creates a
couple of unaligned loads to arg0:

(insn 101 100 102 (set (reg:SI 150)
        (mem:SI (reg/v/f:DI 115 [ arg0 ]) [0  S4 A8])) scope-reduced.c:60 -1
     (nil))
...
(insn 105 104 106 17 (set (mem:SI (reg/v/f:DI 115 [ arg0 ]) [0  S4 A8])
        (reg:SI 151)) scope-reduced.c:60 -1
     (nil))
>From gcc-bugs-return-441787-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 18:26:37 2014
Return-Path: <gcc-bugs-return-441787-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 832 invoked by alias); 28 Jan 2014 18:26:36 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 779 invoked by uid 48); 28 Jan 2014 18:26:33 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
Date: Tue, 28 Jan 2014 18:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.7.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59679-4-V7XmHSOnuU@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59679-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59679-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02929.txt.bz2
Content-length: 417

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

--- Comment #16 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #15)
> (In reply to Uroš Bizjak from comment #13)
> > Confirmed as tree-optimization problem on 4.9 branch.
> 
> Actually, a middle-end problem, if at all. With -ftree-ter, expand creates a
> couple of unaligned loads to arg0:

s/loads/moves/
>From gcc-bugs-return-441788-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jan 28 18:31:08 2014
Return-Path: <gcc-bugs-return-441788-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3903 invoked by alias); 28 Jan 2014 18:31:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3869 invoked by uid 48); 28 Jan 2014 18:31:04 -0000
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/59968] Unused BT patterns
Date: Tue, 28 Jan 2014 18:31:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: hjl.tools at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-59968-4-0RfBUQ1I5Z@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59968-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59968-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg02930.txt.bz2
Content-length: 874

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY968

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
For

int bar1;
void
__attribute__((noinline))
foo1 (int y)
{
  int z;
  if (!(bar1 & (1 << y)))
    xxx1 ();
  z = bar1 & (1 << y);
  bar1 |= 1 << y;
  bar1 &= ~z;
}

we generate

    movl    bar1(%rip), %edx
    pushq    %rbx
    .cfi_def_cfa_offset 16
    .cfi_offset 3, -16
    movl    %edi, %ebx
    btl    %edi, %edx
    jc    .L3
    call    xxx1
    movl    bar1(%rip), %edx
.L3:
    movl    %ebx, %ecx
    movl    $1, %eax
    sall    %cl, %eax
    movl    %edx, %ecx
    andl    %eax, %ecx
    orl    %edx, %eax
    notl    %ecx
    andl    %ecx, %eax
    movl    %eax, bar1(%rip)
    popq    %rbx
    .cfi_def_cfa_offset 8
    ret

I expect

    btc %edi, bar2(%rip)
    jc .L7
    jmp    xxx2
.L8:
    .p2align 4,,10
    .p2align 3
.L7:
    rep ret


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

* [Bug middle-end/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (13 preceding siblings ...)
  2014-01-28 18:25 ` [Bug middle-end/59679] " ubizjak at gmail dot com
@ 2014-01-29 16:39 ` ubizjak at gmail dot com
  2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: ubizjak at gmail dot com @ 2014-01-29 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Uroš Bizjak <ubizjak at gmail dot com> ---
Some more analysis:

The target code expands non-bwx QImode store

;; MEM[(I8 *)_67] = _69;

via alpha_expand_mov_nobwx, where around line 2229 (config/alpha.c) target
address gets checked with "aligned_memory_operand" predicate.  The pointer is
"reg/v/f:DI 115 [ arg0 ])", and its REGNO_POINTER_ALIGN is 64. This later datum
makes aligned_memory_operand predicate to return true.

The pointer alignment for reg 115 is set in mark_reg_pointer from

(insn 68 67 69 (set (reg/f:DI 134)
        (mem/f:DI (reg/v/f:DI 115 [ arg0 ]) [2 MEM[(struct AV *)_p_36].sv_any+0
S8 A64])) scope-reduced.c:53 -1
     (nil))

since reg 115 is used naked to access 64bit aligned value.

The above (insn 68) is defined in BB 11, where the only predecessor is BB 10 (a
switch), and the only successor is BB 15.

Hovever (insn 101):

(insn 101 100 102 (set (reg:SI 150)
        (mem:SI (reg/v/f:DI 115 [ arg0 ]) [0  S4 A8])) scope-reduced.c:60 -1
     (nil))

which assumes 64 bit pointer alignment, lives in BB 13. Again, the only
predecessor is BB 10, and the only successor is BB 15.

The initialization of reg 115 is in BB 4 from a memory location:

(insn 27 26 0 (set (reg/v:DI 115 [ arg0 ])
        (mem:DI (plus:DI (reg/v/f:DI 76 [ p0 ])
                (const_int -8 [0xfffffffffffffff8])) [27 MEM[(union ANY *)p0_16
+ -8B]+0 S8 A64])) scope-reduced.c:37 -1
     (nil))

and since everything is inside a loop, it looks to me there is no way for GCC
to assume inheritance of pointer alignments in BB 13 from BB 10.
>From gcc-bugs-return-441927-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jan 29 16:44:39 2014
Return-Path: <gcc-bugs-return-441927-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 28528 invoked by alias); 29 Jan 2014 16:44:38 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 28499 invoked by uid 48); 29 Jan 2014 16:44:34 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
Date: Wed, 29 Jan 2014 16:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 4.7.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.7.4
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-59679-4-56zZw9xLNS@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59679-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59679-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg03069.txt.bz2
Content-length: 729

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com

--- Comment #18 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #17)

> and since everything is inside a loop, it looks to me there is no way for
> GCC to assume inheritance of pointer alignments in BB 13 from BB 10.

The last line should read:

GCC to assume inheritance of pointer alignments in BB 13 from BB 11.

This is middle-end infrastructure problem. Adding CC.
>From gcc-bugs-return-441928-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jan 29 16:46:04 2014
Return-Path: <gcc-bugs-return-441928-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 29519 invoked by alias); 29 Jan 2014 16:46:04 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 29498 invoked by uid 48); 29 Jan 2014 16:46:01 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/21609] array_allocator vs rebind & templated constructor
Date: Wed, 29 Jan 2014 16:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.0.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-21609-4-f17IXYjFZT@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-21609-4@http.gcc.gnu.org/bugzilla/>
References: <bug-21609-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-01/txt/msg03070.txt.bz2
Content-length: 161

http://gcc.gnu.org/bugzilla/show_bug.cgi?id!609

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I agree, let's deprecate it for 4.9.


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

* [Bug middle-end/59679] gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha
  2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
                   ` (14 preceding siblings ...)
  2014-01-29 16:39 ` ubizjak at gmail dot com
@ 2014-06-12 13:53 ` rguenth at gcc dot gnu.org
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59679

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.4                       |---

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
Unsetting target milestone of open non-regression bug from version of branch
being closed.


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

end of thread, other threads:[~2014-06-12 13:53 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-05  1:57 [Bug c/59679] New: gcc version 4.7.3 and gcc version 4.5.3 cause an unaligned access exception on NetBSD/Alpha nullnilaki at gmail dot com
2014-01-05 20:57 ` [Bug target/59679] " nullnilaki at gmail dot com
2014-01-05 20:57 ` nullnilaki at gmail dot com
2014-01-05 21:02 ` nullnilaki at gmail dot com
2014-01-05 23:08 ` pinskia at gcc dot gnu.org
2014-01-06 16:01 ` nullnilaki at gmail dot com
2014-01-06 16:32 ` nullnilaki at gmail dot com
2014-01-06 16:56 ` nullnilaki at gmail dot com
2014-01-06 16:57 ` nullnilaki at gmail dot com
2014-01-26 22:56 ` mcree at orcon dot net.nz
2014-01-26 23:00 ` mcree at orcon dot net.nz
2014-01-26 23:01 ` mcree at orcon dot net.nz
2014-01-28 16:54 ` [Bug tree-optimization/59679] " ubizjak at gmail dot com
2014-01-28 17:17 ` ubizjak at gmail dot com
2014-01-28 18:25 ` [Bug middle-end/59679] " ubizjak at gmail dot com
2014-01-29 16:39 ` ubizjak at gmail dot com
2014-06-12 13:53 ` rguenth at gcc dot gnu.org

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