Issue Details (XML | Word | Printable)

Key: PCC-393
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Anders Magnusson
Reporter: Martin Ettl
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Found usage of uninitialized variable in file /pcc-1.0.0/arch/hppa/code.c at line 149

Created: 06/Jun/12 10:45 AM   Updated: 06/Jun/12 11:29 AM
Component/s: None
Affects Version/s: None
Fix Version/s: None

 Description  « Hide
I found a bug in pcc, where an uninitialized variable is used.

Please take a look at following code snippet from file /pcc-1.0.0/arch/hppa/code.c at line 149

bfcode(struct symtab **a, int cnt)
struct symtab *sp;
NODE *p, *q;
int i, n, sz; /* <-- variable is declared */

if (cftnsp->stype == STRTY+FTN || cftnsp->stype == UNIONTY+FTN) {
/* Function returns struct, adjust arg offset */
for (i = 0; i < n; i++) /*<-- variable n is used uninitialized*/
a[i]->soffset += SZPOINT(LONG);

As you can see, the variable n is used uninitialized!

Best regards

Martin Ettl

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 06/Jun/12 11:29 AM
True; this was still wrong in -current. FIxed now, thanks.