Issue Details (XML | Word | Printable)

Key: PCC-357
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Anders Magnusson
Reporter: TAKAHASHI Tamotsu
Votes: 0
Watchers: 0
Operations

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

fails to check invalid redeclaration (like #162)

Created: 15/Jun/11 08:06 AM   Updated: 30/Jul/12 06:55 PM
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None


 Description  « Hide
PCC doesn't complain building this code:

   #include <stdio.h>
   int f(int a)
   {
     printf("%d\n", a);
     char a; /* BUG */
     printf("%d\n", a);
     return a;
   }
   int main (){
     return f(60000);
   }

Of course, the second printf outputs random numbers.

gcc:
test.c: In function 'f':
test.c:5: error: 'a' redeclared as different kind of symbol
test.c:2: error: previous definition of 'a' was here



 All   Comments   Change History      Sort Order: Descending order - Click to sort in ascending order
Anders Magnusson added a comment - 30/Jul/12 06:55 PM
This bug is fixed, thanks.

Anders Magnusson added a comment - 06/Jul/11 07:04 PM
I'll rewrite some parts of declaration of automatic variables soon, it will be fixed then.