public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/43013]  New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector
@ 2010-02-09 22:17 zsojka at seznam dot cz
  2010-02-09 22:21 ` [Bug tree-optimization/43013] " zsojka at seznam dot cz
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-02-09 22:17 UTC (permalink / raw)
  To: gcc-bugs

There are 3 possible problems:
1) bootstrap with BOOT_CFLAGS="-O2 -fstack-protector" fails when compiling
i386.o
2) warning in testcase.c
3) warning about x.0 in testcase2.c, crashing output binary

I don't know if any of these problems is a real bug.

All testcases were tested with recent builds of gcc trunk and 4.4 branch.

ad 1)
Bootstrap fails with BOOT_CFLAGS="-O2 -fstack-protector"

$ gcc-4.4.3 -fstack-check -Wuninitialized -Wno-format -Werror -O2 i386.i -c
cc1: warnings being treated as errors
/mnt/svn/gcc-trunk/gcc/config/i386/i386.c: In function
‘ix86_expand_vector_init_duplicate’:
/mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26684: error:
‘dperm.4211’ may be used uninitialized in this function
/mnt/svn/gcc-trunk/gcc/config/i386/i386.c:26706: error:
‘saved_stack.4216’ may be used uninitialized in this function


ad 2)
This file, testcase.c, was reduced from gcc/config/i386/i386.c
---------- testcase.c ----------
void foo(void)
{
  goto lab;
  {
    int x[64];
    lab:;
  }
}
--------------------------------

$ gcc-4.4.3 -Wuninitialized -c testcase.c

$ gcc-4.4.3 -fstack-check -Wuninitialized -c testcase.c
testcase.c: In function ‘foo’:
testcase.c:7: warning: ‘saved_stack.1’ is used uninitialized in
this function

(behaviour is the same with -O1, -O2, -O3)


ad 3)
Second testcase crashes when compiled with -fstack-protector:
---------- testcase2.c ----------
__attribute__((noinline)) int foo(void)
{
  goto lab;
  {
    int x[64];
    lab:;
    x[63] = 0;
    return x[63];
  }
}

int main()
{
  return foo();
}
--------------------------------

$ gcc-4.4.3 -Wuninitialized testcase2.c && ./a.out

$ gcc-4.4.3 -fstack-check -Wuninitialized testcase2.c && ./a.out
testcase2.c: In function ‘foo’:
testcase2.c:7: warning: ‘x.0’ is used uninitialized in this
function
testcase2.c:9: warning: ‘saved_stack.1’ is used uninitialized in
this function
Segmentation fault (SIGSEGV)

(behaviour is the same with -O1, -O2, -O3)


-- 
           Summary: "warning: 'saved_stack.1' is used uninitialized in this
                    function" with -fstack-protector
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug tree-optimization/43013] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
@ 2010-02-09 22:21 ` zsojka at seznam dot cz
  2010-02-09 23:33 ` [Bug tree-optimization/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-02-09 22:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zsojka at seznam dot cz  2010-02-09 22:21 -------
BOOT_CFLAGS="-O2 -fstack-protector"
should be
BOOT_CFLAGS="-O2 -fstack-check"


-- 


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


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

* [Bug tree-optimization/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
  2010-02-09 22:21 ` [Bug tree-optimization/43013] " zsojka at seznam dot cz
@ 2010-02-09 23:33 ` pinskia at gcc dot gnu dot org
  2010-02-10  9:11 ` [Bug middle-end/43013] [4.4/4.5 " jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-09 23:33 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
           Keywords|                            |diagnostic, wrong-code
            Summary|"warning: 'saved_stack.1' is|[4.5 Regression] "warning:
                   |used uninitialized in this  |'saved_stack.1' is used
                   |function" with -fstack-check|uninitialized in this
                   |                            |function" with -fstack-check
   Target Milestone|---                         |4.5.0


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


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

* [Bug middle-end/43013] [4.4/4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
  2010-02-09 22:21 ` [Bug tree-optimization/43013] " zsojka at seznam dot cz
  2010-02-09 23:33 ` [Bug tree-optimization/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check pinskia at gcc dot gnu dot org
@ 2010-02-10  9:11 ` jakub at gcc dot gnu dot org
  2010-02-11 12:23 ` [Bug middle-end/43013] [4.5 " ebotcazou at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-02-10  9:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2010-02-10 09:11 -------
This is actually a regression from 4.3, caused most probably by
http://gcc.gnu.org/viewcvs?view=revision&revision=139159
For VLAs GCC errors out if a goto jumps into a scope with a VLA, for
-fstack-check it obviously can't error out, but probably needs to avoid
emitting the stack checks in that case, or conditionalize them.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-02-10 09:11:40
               date|                            |
            Summary|[4.5 Regression] "warning:  |[4.4/4.5 Regression]
                   |'saved_stack.1' is used     |"warning: 'saved_stack.1' is
                   |uninitialized in this       |used uninitialized in this
                   |function" with -fstack-check|function" with -fstack-check
   Target Milestone|4.5.0                       |4.4.4


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


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

* [Bug middle-end/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-02-10  9:11 ` [Bug middle-end/43013] [4.4/4.5 " jakub at gcc dot gnu dot org
@ 2010-02-11 12:23 ` ebotcazou at gcc dot gnu dot org
  2010-02-11 16:55 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-02-11 12:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ebotcazou at gcc dot gnu dot org  2010-02-11 12:23 -------
I'll write a book about -fstack-check someday...  -fstack-check was severely
broken during the GCC3 -> GCC4 transition and, despite years of patches posting
and pinging, only GCC 4.5 has the beginning of a working implementation, so
anything between 4.0 and 4.4 must be forgotten since totally broken.

And, again despite posted patches, the 4.5 implementation only restores the old
implementation available in the 3.x series, which doesn't work for this case:

eric@atlantis:~/build/gcc/native32> ~/install/gcc-3_4-branch/bin/gcc -v
Reading specs from
/home/eric/install/gcc-3_4-branch/lib/gcc/x86_64-suse-linux/3.4.6/specs
Configured with: /home/eric/svn/gcc-3_4-branch/configure x86_64-suse-linux
--prefix=/home/eric/install/gcc-3_4-branch
--enable-languages=c,c++,objc,f77,java,ada --enable-__cxa_atexit
Thread model: posix
gcc version 3.4.6

eric@atlantis:~/build/gcc/native32> ~/install/gcc-3_4-branch/bin/gcc -m32 -S
pr43013.c

eric@atlantis:~/build/gcc/native32> ~/install/gcc-3_4-branch/bin/gcc -m32 -S
pr43013.c -fstack-check
pr43013.c: In function `foo':
pr43013.c:6: error: label 'lab' used before containing binding contour

Granted, we now generate wrong code instead of erroring out, but it's again a
fallout of the GCC3 -> GCC4 breakage, not of my patches.

This will be fixed once the improved implementation is merged.  ETA is 4.6, for
x86/x86-64 at least.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.4/4.5 Regression]        |[4.5 Regression] "warning:
                   |"warning: 'saved_stack.1' is|'saved_stack.1' is used
                   |used uninitialized in this  |uninitialized in this
                   |function" with -fstack-check|function" with -fstack-check


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


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

* [Bug middle-end/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-02-11 12:23 ` [Bug middle-end/43013] [4.5 " ebotcazou at gcc dot gnu dot org
@ 2010-02-11 16:55 ` rguenth at gcc dot gnu dot org
  2010-02-11 18:28 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-02-11 16:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-02-11 16:55 -------
P4 according to comment #3


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4


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


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

* [Bug middle-end/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-02-11 16:55 ` rguenth at gcc dot gnu dot org
@ 2010-02-11 18:28 ` pinskia at gcc dot gnu dot org
  2010-02-11 18:55 ` ebotcazou at gcc dot gnu dot org
  2010-04-30  9:25 ` [Bug middle-end/43013] [4.5/4.6 " jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-11 18:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2010-02-11 18:28 -------
Note this works correctly on targets that define STACK_CHECK_BUILTIN to be 1. 
This includes the spu target. The main reason is that the code goes through a
different path.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 GCC target triplet|                            |i?86-*-* x86_64-*-*
                   |                            |powerpc*-*-*


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


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

* [Bug middle-end/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-02-11 18:28 ` pinskia at gcc dot gnu dot org
@ 2010-02-11 18:55 ` ebotcazou at gcc dot gnu dot org
  2010-04-30  9:25 ` [Bug middle-end/43013] [4.5/4.6 " jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-02-11 18:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from ebotcazou at gcc dot gnu dot org  2010-02-11 18:55 -------
> Note this works correctly on targets that define STACK_CHECK_BUILTIN to be 1. 
> This includes the spu target. The main reason is that the code goes through a
> different path.

Indeed, only generic stack checking is affected, so every target except for the
Alpha and SPU.  The plan for 4.6 is to switch the other targets (or at least
x86 and x86-64) to STACK_CHECK_STATIC_BUILTIN, which isn't affected either.


-- 


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


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

* [Bug middle-end/43013] [4.5/4.6 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
  2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2010-02-11 18:55 ` ebotcazou at gcc dot gnu dot org
@ 2010-04-30  9:25 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-04-30  9:25 UTC (permalink / raw)
  To: gcc-bugs



-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.4.4                       |4.4.5


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


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

* [Bug middle-end/43013] [4.5 regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
       [not found] <bug-43013-4@http.gcc.gnu.org/bugzilla/>
  2012-05-26 14:24 ` [Bug middle-end/43013] [4.5 regression] " ebotcazou at gcc dot gnu.org
@ 2012-07-02 10:47 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-07-02 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.5.4                       |4.6.0

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-07-02 10:47:13 UTC ---
Fixed in 4.6.0, the 4.5 branch is being closed.


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

* [Bug middle-end/43013] [4.5 regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check
       [not found] <bug-43013-4@http.gcc.gnu.org/bugzilla/>
@ 2012-05-26 14:24 ` ebotcazou at gcc dot gnu.org
  2012-07-02 10:47 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-05-26 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.5/4.6/4.7/4.8            |[4.5 regression] "warning:
                   |regression] "warning:       |'saved_stack.1' is used
                   |'saved_stack.1' is used     |uninitialized in this
                   |uninitialized in this       |function" with
                   |function" with              |-fstack-check
                   |-fstack-check               |

--- Comment #8 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-05-26 14:17:26 UTC ---
Fixed on mainstream platforms since 4.6.


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

end of thread, other threads:[~2012-07-02 10:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-09 22:17 [Bug tree-optimization/43013] New: "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-protector zsojka at seznam dot cz
2010-02-09 22:21 ` [Bug tree-optimization/43013] " zsojka at seznam dot cz
2010-02-09 23:33 ` [Bug tree-optimization/43013] [4.5 Regression] "warning: 'saved_stack.1' is used uninitialized in this function" with -fstack-check pinskia at gcc dot gnu dot org
2010-02-10  9:11 ` [Bug middle-end/43013] [4.4/4.5 " jakub at gcc dot gnu dot org
2010-02-11 12:23 ` [Bug middle-end/43013] [4.5 " ebotcazou at gcc dot gnu dot org
2010-02-11 16:55 ` rguenth at gcc dot gnu dot org
2010-02-11 18:28 ` pinskia at gcc dot gnu dot org
2010-02-11 18:55 ` ebotcazou at gcc dot gnu dot org
2010-04-30  9:25 ` [Bug middle-end/43013] [4.5/4.6 " jakub at gcc dot gnu dot org
     [not found] <bug-43013-4@http.gcc.gnu.org/bugzilla/>
2012-05-26 14:24 ` [Bug middle-end/43013] [4.5 regression] " ebotcazou at gcc dot gnu.org
2012-07-02 10:47 ` 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).