Bug 14204

Summary: [tree-ssa] Bogus uninitialized warning for stack pointer register var
Product: gcc Reporter: Falk Hueffner <falk>
Component: cAssignee: Richard Henderson <rth>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P2 Keywords: diagnostic
Version: tree-ssa   
Target Milestone: tree-ssa   
Host: alphaev68-unknown-linux-gnu Target: alphaev68-unknown-linux-gnu
Build: alphaev68-unknown-linux-gnu Known to work:
Known to fail: Last reconfirmed: 2004-02-19 00:31:21
Bug Depends on:    
Bug Blocks: 24639    

Description Falk Hueffner 2004-02-18 23:45:13 UTC
GNU C version 3.5-tree-ssa 20040217 (merged 20040211) (alphaev68-unknown-linux-gnu)
        compiled by GNU C version 3.5-tree-ssa 20040217 (merged 20040211).

% cat test.c
void *load_PCB (void)
{
        register void *sp __asm__("$30");
        return sp;
}

% gcc -O -c -W -Wall test.c 
test.c: In function `load_PCB':
test.c:4: warning: 'sp' is used uninitialized in this function

$30 is the stack pointer, which must be kept valid by gcc all the time,
so this shouldn't produce a warning.
Comment 1 Andrew Pinski 2004-02-19 00:31:20 UTC
Confirmed, basically now the warning is done at the tree level, the warning does not track registers but 
now just variables.
Comment 2 Andrew Pinski 2004-03-04 07:39:52 UTC
Here is the PPC equivent:
void *load_PCB (void)
{
        register void *sp __asm__("r1");
        return sp;
}
Comment 3 CVS Commits 2004-03-12 02:01:31 UTC
Subject: Bug 14204

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	rth@gcc.gnu.org	2004-03-12 02:01:21

Modified files:
	gcc            : ChangeLog.tree-ssa tree-ssa.c 
Added files:
	gcc/testsuite/gcc.dg: uninit-H.c 

Log message:
	PR 14204
	* tree-ssa.c (warn_uninit): Don't warn for hard register variables.
	* gcc.dg/uninit-H.c: New.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.1268&r2=1.1.2.1269
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.4.209&r2=1.1.4.210
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/uninit-H.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1

Comment 4 Richard Henderson 2004-03-12 02:02:42 UTC
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00996.html