public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jkanapes at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105950] New: >  O2 optimization causes runtime (SIGILL) during main initialization
Date: Mon, 13 Jun 2022 14:17:15 +0000	[thread overview]
Message-ID: <bug-105950-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105950
           Summary: >  O2 optimization causes runtime (SIGILL) during main
                    initialization
           Product: gcc
           Version: 9.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jkanapes at yahoo dot com
  Target Milestone: ---

Created attachment 53128
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53128&action=edit
gcc -v -save -temps

Recently upgraded to Ubuntu 20.04, and a program that compiled & ran fine in
Ubuntu 14.04, now coredumps in execution when optimization greater than -O2 is
used during compilation. No warnings in compilation.
When compiled with -O3 -g flags I get gdb output to the offending code
(SIGILL):
size_t channel = 0;
uhd_stream_args_t stream_args =
                      {
                         .cpu_format = "fc32",
                         .otw_format = "sc16",
                         .args = "",
                         .channel_list = &channel,
                         .n_channels = 1
                      };
uhd_stream_atgs_t is defined in the included header:
typedef struct {
    //! Format of host memory
    char* cpu_format;
    //! Over-the-wire format
    char* otw_format;
    //! Other stream args
    char* args;
    //! Array that lists channels
    size_t* channel_list;
    //! Number of channels
    int n_channels;
} uhd_stream_args_t;

The offending code is the next block. This initialization code used to work
fine. It bow works fine with -O2 or less optimization. It compiles fine. Why
does gcc create the wrong executable?

Attaching the gcc -v -save-temps output

             reply	other threads:[~2022-06-13 14:17 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13 14:17 jkanapes at yahoo dot com [this message]
2022-06-13 15:35 ` [Bug c/105950] " redi at gcc dot gnu.org
2022-06-13 16:40 ` jkanapes at yahoo dot com
2022-06-13 17:02 ` jakub at gcc dot gnu.org
2022-06-13 17:18 ` jkanapes at yahoo dot com
2022-06-13 17:21 ` jkanapes at yahoo dot com
2022-06-13 19:31 ` redi at gcc dot gnu.org
2022-06-13 19:32 ` redi at gcc dot gnu.org
2022-06-14  4:13 ` jkanapes at yahoo dot com
2022-06-14  8:16 ` rguenth at gcc dot gnu.org
2022-06-14  9:14 ` redi at gcc dot gnu.org
2022-06-14  9:27 ` jkanapes at yahoo dot com
2022-06-14  9:36 ` jakub at gcc dot gnu.org
2022-06-14 10:04 ` jkanapes at yahoo dot com
2022-06-14 10:15 ` jkanapes at yahoo dot com
2022-06-14 11:35 ` redi at gcc dot gnu.org
2022-06-14 12:05 ` jkanapes at yahoo dot com
2022-06-14 12:12 ` jakub at gcc dot gnu.org
2022-06-14 12:19 ` redi at gcc dot gnu.org
2022-06-14 12:32 ` jkanapes at yahoo dot com
2022-06-14 12:42 ` jkanapes at yahoo dot com
2022-06-14 12:52 ` redi at gcc dot gnu.org
2022-06-14 13:02 ` jkanapes at yahoo dot com
2022-06-14 14:42 ` jkanapes at yahoo dot com
2022-06-14 15:30 ` sam at gentoo dot org
2022-06-14 15:36 ` redi at gcc dot gnu.org
2022-06-14 16:56 ` jkanapes at yahoo dot com
2022-06-15 11:18 ` jkanapes at yahoo dot com
2022-06-15 11:30 ` jakub at gcc dot gnu.org
2022-06-15 12:19 ` jkanapes at yahoo dot com
2022-06-15 12:26 ` jkanapes at yahoo dot com
2022-06-15 12:27 ` sam at gentoo dot org
2022-06-15 12:29 ` jkanapes at yahoo dot com
2022-06-15 12:32 ` sam at gentoo dot org
2022-06-15 12:42 ` jkanapes at yahoo dot com
2022-06-15 12:48 ` jkanapes at yahoo dot com
2022-06-15 13:15 ` jkanapes at yahoo dot com
2022-06-15 13:20 ` jakub at gcc dot gnu.org
2022-06-15 14:23 ` jkanapes at yahoo dot com
2022-06-15 14:29 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105950-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).