public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/98922] New: -fstack-usage not working with -flto
@ 2021-02-01 17:08 Visda.vokhshoori at microchip dot com
  2021-02-02  8:20 ` [Bug lto/98922] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Visda.vokhshoori at microchip dot com @ 2021-02-01 17:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98922

            Bug ID: 98922
           Summary: -fstack-usage not working with -flto
           Product: gcc
           Version: 8.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Visda.vokhshoori at microchip dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

With link time optimization, -flto, the compiler doesn't print the stack usage
information to auxname.su file. 

With -flto, the compiler dumps the stack usage of each function in
sourcfile/auxname.ltrans0.ltrans.su file. 

However, maybe_unlink() in lto_wrapper.c removes all trans files, unless
--save-temps is specified.

To reproduce:  
You can modify "gcc.dg/stack-usage-1.c": test case source to call foo() in
main(), and compile and link with flto and fstack-usage options, and scan for {
dg-final { scan-stack-usage "foo\t\(0\)\tstatic" } } 

The scan will fail.

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

* [Bug lto/98922] -fstack-usage not working with -flto
  2021-02-01 17:08 [Bug lto/98922] New: -fstack-usage not working with -flto Visda.vokhshoori at microchip dot com
@ 2021-02-02  8:20 ` rguenth at gcc dot gnu.org
  2021-02-02 13:11 ` marxin at gcc dot gnu.org
  2021-02-04 14:42 ` Visda.vokhshoori at microchip dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-02-02  8:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98922

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org,
                   |                            |ebotcazou at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
With GCC 11 I get the files named <linker-output>.ltransN.ltrans.su and not
removed.  With GCC 10 they get some temporary name but also are not removed,
likewise with GCC 7.  Those temp files will reside in $TMPDIR and have
names like ccwn8X1t.ltrans0.ltrans.su

So I guess this improved with GCC 11 and the refactoring of aux file handling.

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

* [Bug lto/98922] -fstack-usage not working with -flto
  2021-02-01 17:08 [Bug lto/98922] New: -fstack-usage not working with -flto Visda.vokhshoori at microchip dot com
  2021-02-02  8:20 ` [Bug lto/98922] " rguenth at gcc dot gnu.org
@ 2021-02-02 13:11 ` marxin at gcc dot gnu.org
  2021-02-04 14:42 ` Visda.vokhshoori at microchip dot com
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-02 13:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98922

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-02-02
     Ever confirmed|0                           |1

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Yes, the current master behaves well.
I tend to close this as resolved, Richi?

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

* [Bug lto/98922] -fstack-usage not working with -flto
  2021-02-01 17:08 [Bug lto/98922] New: -fstack-usage not working with -flto Visda.vokhshoori at microchip dot com
  2021-02-02  8:20 ` [Bug lto/98922] " rguenth at gcc dot gnu.org
  2021-02-02 13:11 ` marxin at gcc dot gnu.org
@ 2021-02-04 14:42 ` Visda.vokhshoori at microchip dot com
  2 siblings, 0 replies; 4+ messages in thread
From: Visda.vokhshoori at microchip dot com @ 2021-02-04 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98922

--- Comment #3 from Visda <Visda.vokhshoori at microchip dot com> ---
I looked at GCC 11 release notes, and found the fix
https://gcc.gnu.org/pipermail/gcc-patches/2020-May/546494.html
Please correct me if I am wrong.

Given where we are in our release cycle, we decided to postpone pulling in this
patch.  For now, I fixed this in our local branch.  

We will get the new behaviour when we move up to GCC 11+.

Thanks.

FYI:
My local fix is:
diff --git a/gcc/toplev.c b/gcc/toplev.c
index bdf021e828a..e476c109cb4 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1050,7 +1050,10 @@ open_auxiliary_file (const char *ext)
   char *filename;
   FILE *file;

-  filename = concat (aux_base_name, ".", ext, NULL);
+#ifdef _BUILD_AVR3
+  if (strcmp (ext, "su") == 0 && flag_stack_usage)
+    filename = concat (lbasename(aux_base_name), ".", ext, NULL);
+  else
+#endif
+    filename = concat (aux_base_name, ".", ext, NULL);
   file = fopen (filename, "w");
   if (!file)
     fatal_error (input_location, "can%'t open %s for writing: %m", filename);
@@ -1898,7 +1901,7 @@ lang_dependent_init (const char *name)
       init_asm_output (name);

       /* If stack usage information is desired, open the output file.  */
-      if (flag_stack_usage)
+      if (flag_stack_usage 
+#ifdef _BUILD_AVR3
           && !flag_generate_lto
+#endif)
        stack_usage_file = open_auxiliary_file ("su");
     }

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

end of thread, other threads:[~2021-02-04 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 17:08 [Bug lto/98922] New: -fstack-usage not working with -flto Visda.vokhshoori at microchip dot com
2021-02-02  8:20 ` [Bug lto/98922] " rguenth at gcc dot gnu.org
2021-02-02 13:11 ` marxin at gcc dot gnu.org
2021-02-04 14:42 ` Visda.vokhshoori at microchip dot com

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).