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

            Bug ID: 117288
           Summary: [15 Regression] LTO ICE in
                    output_constructor_regular_field at varasm.cc:5644 on
                    wolfssl-5.7.2
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Initially observed ICE on wolfssl-5.7.2 built in LTO mode.

Current gcc-master from r15-4622-g6aba48a8cc128e still crashes.

Single-file reproducer:

// $ cat api.c
typedef unsigned char byte;

__attribute__((noipa)) static void use(const void*) {}

static void test_wolfSSL_dtls_send_ch(void)
{
    byte ch_msg[81] = {
        0x16, 0xfe, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x01, 0xfa, 0x01, 0x00, 0x01,
        0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
        0xee, 0xfe, 0xfd, 0xc0, 0xca, 0xb5, 0x6f, 0x3d,
        0x23, 0xcc, 0x53, 0x9a, 0x67, 0x17, 0x70, 0xd3,
        0xfb, 0x23, 0x16, 0x9e, 0x4e, 0xd6, 0x7e, 0x29,
        0xab, 0xfa, 0x4c, 0xa5, 0x84, 0x95, 0xc3, 0xdb,
        0x21, 0x9a, 0x52, 0x00, 0x00, 0x00, 0x36, 0x13,
        0x01, 0x13, 0x02, 0x13, 0x03, 0xc0, 0x2c, 0xc0,
        0x2b, 0xc0, 0x30, 0xc0, 0x2f, 0x00, 0x9f, 0x00,
        0x9e,
    };

    use(&ch_msg);
}

static void test_wc_AesEaxVectors(void)
{
    typedef struct {
        byte key[32];
        int key_length;
        byte iv[32];
        int iv_length;
        byte aad[16 * 2];
        int aad_length;
        byte msg[16 * 5];
        int msg_length;
        byte ct[16 * 5];
        int ct_length;
    } AadVector;

    const AadVector vector =
        {
            /* key, key length  */
            {0x00, }, 16,
            /* iv, iv length  */
            {0x4f, }, 16,
            /* aad, aad length  */
            {0x00}, 0,
            /* msg, msg length  */
            {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
             0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
             0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
             0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
             0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
             0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
             0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33,
             0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44,
             0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44}, 80,
            /* ct, ct length  */
            {0xe9, }, 80,
        };

        use(vector.msg);
}

int main(void) {
    use(&test_wc_AesEaxVectors);
    use(&test_wolfSSL_dtls_send_ch);
}

Crashing:

$ gcc/xgcc -Bgcc api.c -o a.bug -flto
during RTL pass: final
api.c: In function ‘test_wc_AesEaxVectors’:
api.c:65:1: internal compiler error: in output_constructor_regular_field, at
varasm.cc:5644
   65 | }
      | ^
0x23f9bcf diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x240b89b internal_error(char const*, ...)
        ???:0
0x23f6aa0 fancy_abort(char const*, int, char const*)
        ???:0
0x125a968 output_constructor(tree_node*, unsigned long, unsigned int, bool,
oc_outer_state*)
        ???:0
0x12597a3 output_constant(tree_node*, unsigned long, unsigned int, bool, bool)
        ???:0
0x1259847 assemble_constant_contents(tree_node*, char const*, unsigned int,
bool)
        ???:0
0x125ff82 output_constant_def_contents(rtx_def*)
        ???:0
0x1260064 mark_constants_in_pattern(rtx_def*)
        ???:0
0x12658e2 assemble_start_function(tree_node*, char const*)
        ???:0
0x9b29dd (anonymous namespace)::pass_final::execute(function*)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: gcc/xgcc returned 1 exit status
compilation terminated.
/nix/store/vcvhwiilizhijk7ywyn58p9l005n9sbn-binutils-2.43.1/bin/ld: ошибка:
lto-wrapper failed
collect2: error: ld returned 1 exit status

$ gcc/xgcc -Bgcc -v
Reading specs from gcc/specs
COLLECT_GCC=gcc/xgcc
COLLECT_LTO_WRAPPER=gcc/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/slyfox/dev/git/gcc/configure --disable-multilib
--disable-bootstrap --disable-lto --disable-libsanitizer --enable-languages=c
CFLAGS='-O1 -g0' CXXFLAGS='-O1 -g0' LDFLAGS='-O1 -g0' --enable-lto
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241024 (experimental) (GCC)

Reply via email to