Bug 53004 - Segmentation fault can be overcome with dummy predefined declaration
Summary: Segmentation fault can be overcome with dummy predefined declaration
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.5.2
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-16 08:53 UTC by gursoyturan
Modified: 2012-04-16 10:48 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-04-16 00:00:00


Attachments
C-Source code (228 bytes, text/plain)
2012-04-16 09:57 UTC, gursoyturan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gursoyturan 2012-04-16 08:53:00 UTC
The program compiles, but only runs if a dummy predefined variable is inserted as below

float dummy=1;
Comment 1 Andrew Pinski 2012-04-16 09:46:46 UTC
There is no attached source code.
Can you attach the source code where you are having the seg fault at runtime?

I bet you have a buffer overflow in your code though.
Comment 2 gursoyturan 2012-04-16 09:57:08 UTC
Created attachment 27166 [details]
C-Source code

C-source code
Comment 3 Andreas Schwab 2012-04-16 10:37:17 UTC
You are using an uninitialized pointer.
Comment 4 Manuel López-Ibáñez 2012-04-16 10:48:28 UTC
And GCC tells you so:

manuel@gcc12:~$ ~/trunk/186353M/build/gcc/cc1 -Wall tmp.c 
tmp.c:3:6: warning: return type of ‘main’ is not ‘int’ [-Wmain]
 void main()
      ^
tmp.c: In function ‘main’:
tmp.c:8:8: warning: ‘prod_vg’ is used uninitialized in this function [-Wuninitialized]
   multg(prod_vg);
        ^

Now that -Wuninitialized is separated from -Wmaybe-uninitialized, maybe it is time to enable it by default.