public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Question on path from C parser to DECL_INITIAL
@ 2022-03-23 11:53 Erick Ochoa
  2022-03-23 12:23 ` Richard Biener
  2022-03-23 12:46 ` Martin Jambor
  0 siblings, 2 replies; 4+ messages in thread
From: Erick Ochoa @ 2022-03-23 11:53 UTC (permalink / raw)
  To: gcc

Hi,

I am trying to understand what path is executed in GCC from parsing a C
expression (in a global variable declaration) to the value in DECL_INITIAL.
At the moment, I have annotated a tree during parsing. I have another
debugging pass that looks for this tree in subsequent passes. The
annotation persists if the tree is inside a function body. However, if the
tree is in a global variable initialization (i.e., DECL_INITIAL), then I am
unable to see the annotation even when placing the debugging pass at the
beginning of passes.def.

Can someone provide a little bit of guidance?

Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question on path from C parser to DECL_INITIAL
  2022-03-23 11:53 Question on path from C parser to DECL_INITIAL Erick Ochoa
@ 2022-03-23 12:23 ` Richard Biener
  2022-03-23 12:31   ` Erick Ochoa
  2022-03-23 12:46 ` Martin Jambor
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Biener @ 2022-03-23 12:23 UTC (permalink / raw)
  To: Erick Ochoa; +Cc: GCC Development

On Wed, Mar 23, 2022 at 12:55 PM Erick Ochoa via Gcc <gcc@gcc.gnu.org> wrote:
>
> Hi,
>
> I am trying to understand what path is executed in GCC from parsing a C
> expression (in a global variable declaration) to the value in DECL_INITIAL.
> At the moment, I have annotated a tree during parsing. I have another
> debugging pass that looks for this tree in subsequent passes. The
> annotation persists if the tree is inside a function body. However, if the
> tree is in a global variable initialization (i.e., DECL_INITIAL), then I am
> unable to see the annotation even when placing the debugging pass at the
> beginning of passes.def.
>
> Can someone provide a little bit of guidance?

I'm not sure I understand but no pass walks 'global variables', so you're not
going to "see" the annotation from passes (whatever that means).

Richard.

>
> Thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question on path from C parser to DECL_INITIAL
  2022-03-23 12:23 ` Richard Biener
@ 2022-03-23 12:31   ` Erick Ochoa
  0 siblings, 0 replies; 4+ messages in thread
From: Erick Ochoa @ 2022-03-23 12:31 UTC (permalink / raw)
  To: Richard Biener; +Cc: Erick Ochoa, GCC Development

> I'm not sure I understand but no pass walks 'global variables', so you're
> not
> going to "see" the annotation from passes (whatever that means).
>
>
What I mean by walking global variables is that I have a GIMPLE_PASS that
ignores the function sent as an argument and instead just uses a
FOR_EACH_VARIABLE to look at varpool nodes and check if the DECL_INITIAL
has a field set or unset. I can print the variable, and DECL_INITIAL.
However the DECL_INITIAL tree always has the field unset even though I am
setting it during c_sizeof_or_alignof_type. The initialization looks simply
as:

int a = sizeof (foo);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Question on path from C parser to DECL_INITIAL
  2022-03-23 11:53 Question on path from C parser to DECL_INITIAL Erick Ochoa
  2022-03-23 12:23 ` Richard Biener
@ 2022-03-23 12:46 ` Martin Jambor
  1 sibling, 0 replies; 4+ messages in thread
From: Martin Jambor @ 2022-03-23 12:46 UTC (permalink / raw)
  To: Erick Ochoa; +Cc: gcc

Hi,

On Wed, Mar 23 2022, Erick Ochoa via Gcc wrote:
> Hi,
>
> I am trying to understand what path is executed in GCC from parsing a C
> expression (in a global variable declaration) to the value in DECL_INITIAL.
> At the moment, I have annotated a tree during parsing. I have another
> debugging pass that looks for this tree in subsequent passes. The
> annotation persists if the tree is inside a function body. However, if the
> tree is in a global variable initialization (i.e., DECL_INITIAL), then I am
> unable to see the annotation even when placing the debugging pass at the
> beginning of passes.def.
>
> Can someone provide a little bit of guidance?

Sounds like a gdb watchpoint should help here.

Martin


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-23 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 11:53 Question on path from C parser to DECL_INITIAL Erick Ochoa
2022-03-23 12:23 ` Richard Biener
2022-03-23 12:31   ` Erick Ochoa
2022-03-23 12:46 ` Martin Jambor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).