public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99579] New: gmon.out not created with -O0 but otherwise is
@ 2021-03-13 16:49 wsnyder at wsnyder dot org
  2021-03-13 17:45 ` [Bug middle-end/99579] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: wsnyder at wsnyder dot org @ 2021-03-13 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99579
           Summary: gmon.out not created with -O0 but otherwise is
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wsnyder at wsnyder dot org
  Target Milestone: ---

Created attachment 50382
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50382&action=edit
Testcase

== Description

Type "make" in this tarball's directory.

This will show (extra lines omitted):

  g++  -pg -O0  -c -o Vt_case_huge_prof__main.o Vt_case_huge_prof__main.ii
  @@@@@ Did we get a gmon?
  make: [Makefile:15: x] Error 1 (ignored)

  g++  -pg -Os  -c -o Vt_case_huge_prof__main.o Vt_case_huge_prof__main.ii
  @@@@@ Did we get a gmon?
    4554816     28 -rw-rw-r--   1 user  user     26943 Mar 13 11:33 ./gmon.out

  g++  -pg -O0  -c -o Vt_case_huge_prof__main.o Vt_case_huge_prof__main__ok.ii
  @@@@@ Did we get a gmon?
    4554816    884 -rw-rw-r--   1 user  user    897414 Mar 13 11:33 ./gmon.out


In short gcc -pg with -O0 is not creating a gmon.

The problem goes away using -Os.

The problem goes away if line 60549 of ~/d/case/Vt_case_huge_prof__main.ii

    std::array<CData , 16384> __Vtablechg1;

is changed into

    CData __Vtablechg1[16384];

(The original program requires a unique class, not a std::array, so using
C-style arrays is unfortunately not a workaround in my application.)

While this "feels" like a memory corruption sort of bug, 
the program is sanitizer and warning clean.

== gcc --version

gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

== cat /etc/*release

DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS"

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

end of thread, other threads:[~2022-12-16 19:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-13 16:49 [Bug c++/99579] New: gmon.out not created with -O0 but otherwise is wsnyder at wsnyder dot org
2021-03-13 17:45 ` [Bug middle-end/99579] " pinskia at gcc dot gnu.org
2021-03-13 18:51 ` wsnyder at wsnyder dot org
2021-03-13 19:08 ` wsnyder at wsnyder dot org
2022-12-16 19:53 ` pinskia at gcc dot gnu.org
2022-12-16 19:53 ` pinskia at gcc dot gnu.org

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