Hi there,

I'm trying to figure out precisely what NOTE_INSN_FUNCTION_BEG means and 
hoping someone here knows.

The gcc internal documentation says it "Appears at the start of the 
function body, after the function prologue." but this isn't very 
precise, and it seems to not distinguish between the undocumented 
NOTE_INSN_PROLOGUE_END and the NOTE_INSN_FUNCTION_BEG.

A comment in dwarf2out.c shows it's used as a marker between boilerplate 
and code corresponding to things "the user wrote".
This assumption is broken by things like -fstack-protector-strong (as 
bugzilla 88432 shows).

alias.c seems to use it to assume that argument registers have their 
original values before it (see the use of the "copying_arguments" 
variable and find_base_value function).
I'm not yet certain of this, but if that is the assumption I think this 
is also not observed.

The test file below compiles to something breaking that assumption when 
compiled with `gcc -fsanitize=address -S test.c -o test.s -g3 
-fdump-rtl-final -O0` on aarch64.

#include <string.h>
#include <stdio.h>
int main (int argc, char *argv[]) {
         char buf[64];
         return !strcpy (buf, strrchr (argv[0], '/'));
}


Is there any tight meaning to NOTE_INSN_FUNCTION_BEG?

I'm wondering whether it should be split into one note to determine for 
the debugging use and another for the use in alias.c.

Regards,
Matthew

Reply via email to