This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/2243: Misplacement of label at start of function.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/2243: Misplacement of label at start of function.
- From: voel at diku dot dk
- Date: 9 Mar 2001 15:46:42 -0000
- Reply-To: voel at diku dot dk
>Number: 2243
>Category: c
>Synopsis: Misplacement of label at start of function.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Fri Mar 09 07:56:03 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Rasmus Erik Voel Jensen
>Release: gcc version 2.95.2 19991024 (release) (andalso CodeSourcery's Online Test Compilation)
>Organization:
>Environment:
Linux 2.2.16-3, i686
>Description:
Labels in the start of a function is placed at the function
entry instead of inside the function if the following
conditions hold:
* the source is compiled on the i386-platform.
* optimization is enabled (not run with -O0).
* there is no goto's to the label.
>How-To-Repeat:
Compile the following code with ``gcc -O1 labelerr.c''. If
you then look at the objectcode it is clear that the prelude-
size > 0 (ebp is pushed on the stack, and the stackpointer
is saved).
labelerr.c:
/*
* The label should be after the prelude, such that a jump
* to it would not inflect a new stackframe.
* It is misplaced if the code is optimized end there is no
* goto to the label. It is only observed on the ia-32 arch.
*/
int
main(argv, argc)
char **argv;
int argc;
{
label:
printf("Preludesize = %x\n", &&label-((void *)main));
return 1;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: