Summary: | {u,}int64_t variables are incorrectly reported as used uninitialized | ||
---|---|---|---|
Product: | gcc | Reporter: | Christian Limpach <chris> |
Component: | tree-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | minor | CC: | gcc-bugs, sami.kantoluoto |
Priority: | P2 | Keywords: | diagnostic |
Version: | 3.3.2 | ||
Target Milestone: | 4.0.0 | ||
Host: | m68k--netbsdelf | Target: | m68k--netbsdelf |
Build: | i386-unknown-netbsdelf | Known to work: | |
Known to fail: | Last reconfirmed: | 2004-03-04 03:13:43 | |
Bug Depends on: | |||
Bug Blocks: | 24639 | ||
Attachments: | proposed fix |
Created attachment 5014 [details]
proposed fix
The problem is thus:
* The {u,}mulsidi3 generate two parallel sets which modify the upper and lower
halves of the target register.
* life_analysis() does not track subregister modifications -- if you don't
modify the whole register with a single set, it considers the register
unused.
The simple, if klugy, solution to this is to stick an explicit clobber in. It
seems to work.
While doing this, I noticed that constant folding was not happening for
32x32->64 multiplies. This is because the parallel set generated by
{u,}mulsidi3 cannot be folded at all. To solve this, I first expand to a
normal multiply, and then use a define_insn_and_split to convert it to the
parallel set after CSE and constant folding.
The proper fix is to teach life_analysis about the two halves. *** Bug 13136 has been marked as a duplicate of this bug. *** Suspending as this is fixed on the tree-ssa by looking at the tree level instead of the rtl where all problems like this can occur. Fixed for 3.5.0 by the merge of the tree-ssa. |
long long int and long long unsigned int variables trigger the following warning even though the variables are initialized: longlongint.c: In function `main': longlongint.c:7: warning: `blkno' might be used uninitialized in this function reduced test case: ---- cut here ---- # 1 "longlongint.c" # 1 "<built-in>" # 1 "<command line>" # 1 "longlongint.c" int printf (const char * __restrict, ...); int main(int argc, char **argv) { long long int blkno; long long int t5; t5 = 1; blkno = t5 * t5; printf("%lld\n", blkno); return 0; } ---- cut here ---- compilation command: > cc -O1 -Wall longlongint.c -c longlongint.c: In function `main': longlongint.c:7: warning: `blkno' might be used uninitialized in this function There's no warning at -O0, there's a warning at Os, O1 and above.