From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AEA343858D37; Tue, 24 Oct 2023 05:42:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AEA343858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698126171; bh=TyQ3DYxpqU2oACLFnnu92hGP/5ER2LBBqwSJJSGiRGQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Gr1bJrcVZTNTGKgZ0RL3AADaxttY3GQHM4pvuMx6YTVTiV9RWvczGgNyDHHqoKSBs Tutx11/QQNDpjhpIJHv+HoL5oB7gRTqfd5t6/Hl7ftsiePi3eCzHW1Nyah4Xiotvby KIF6vHj43C7KFUqU2sogrt7qjebXz6OqKtLxVHQI= From: "mxlol233 at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111937] [RISCV][lto][offload] When `NUM_POLY_INT_COEFFS` > 1, the `poly_xxx` made `lto_input_mode_table` unable to parse binary gimple data. Date: Tue, 24 Oct 2023 05:42:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mxlol233 at outlook dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111937 --- Comment #3 from Xiao Ma --- Created attachment 56185 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D56185&action=3Dedit a patch on releases/gcc-13 to reproduce the bug. steps: 1. git clone -b releases/gcc-13 https://github.com/gcc-mirror/gcc.git 2. cd gcc 3. #apply this patch 4. mkdir .build_accel && cd .build_accel && ../configure --target=3Drvgpu-n= one --enable-languages=3Dc --enable-as-accelerator-for=3Dx86_64-pc-linux-gnu &&= make all-gcc -j16 5. cd ../ 6. mkdir .build_host && cd .build_host && ../configure --enable-languages= =3Dc --enable-offload-targets=3Drvgpu-none=3D`pwd`/../../.install/rvgpu-none/ &&= make all-gcc -j16 7. cd ../ && mkdir .tmp && cd .tmp 8. # touch a file: ``` /* { dg-do run } */ int main (void) { int i2, l =3D 0, r =3D 0, l2 =3D 0; int a[3][3][3]; #pragma acc parallel #pragma acc loop collapse(4 - 1) for (int i =3D 0; i < 2; i++) for (int j =3D 0; j < 2; j++) for (int k =3D 0; k < 2; k++) a[i][j][k] =3D i + j * 4 + k * 16; #pragma acc parallel { #pragma acc loop collapse(2) reduction(|:l) for (i2 =3D 0; i2 < 2; i2++) for (int j =3D 0; j < 2; j++) for (int k =3D 0; k < 2; k++) if (a[i2][j][k] !=3D i2 + j * 4 + k * 16) l +=3D 1; } /* Test loop with >=3D condition. */ #pragma acc parallel { #pragma acc loop collapse(2) reduction(|:l2) for (i2 =3D 0; i2 < 2; i2++) for (int j =3D 1; j >=3D 0; j--) for (int k =3D 0; k < 2; k++) if (a[i2][j][k] !=3D i2 + j * 4 + k * 16) l2 +=3D 1; } for (i2 =3D 0; i2 < 2; i2++) for (int j =3D 0; j < 2; j++) for (int k =3D 0; k < 2; k++) if (a[i2][j][k] !=3D i2 + j * 4 + k * 16) r +=3D 1; return 0; } ``` 9. ../.build_host/gcc/cc1 -fopenacc -quiet -o a.s a.c # you will see the log like this: ```NUM_POLY_INT_COEFFS=3D1 ``` 10. as --64 -o a.o a.s 11. ../.build_accel/gcc/lto1 -quiet -o a.o.s a.o=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 # you will see the log like this: ``` NUM_POLY_INT_COEFFS=3D2 =E2=80=98 Segmentation fault 0xbf3e83 crash_signal ../../gcc/toplev.cc:314 0x7f92986f608f ??? =20=20=20=20=20=20=20 /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sig= action.c:0 0x7f929883b6e5 ??? ../sysdeps/x86_64/multiarch/strlen-avx2.S:65 0x1773512 pp_quoted_string ../../gcc/pretty-print.cc:1845 0x177435a pp_format(pretty_printer*, text_info*) ../../gcc/pretty-print.cc:1359 0x176495f diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info= *) ../../gcc/diagnostic.cc:1592 0x1765149 diagnostic_impl ../../gcc/diagnostic.cc:1756 0x1767236 fatal_error(unsigned int, char const*, ...) ../../gcc/diagnostic.cc:2141 0xa90e11 lto_input_mode_table(lto_file_decl_data*) ../../gcc/lto-streamer-in.cc:2103 0x748626 lto_file_finalize ../../gcc/lto/lto-common.cc:2275 0x748626 lto_create_files_from_ids ../../gcc/lto/lto-common.cc:2298 0x748626 lto_file_read ../../gcc/lto/lto-common.cc:2353 0x748626 read_cgraph_and_symbols(unsigned int, char const**) ../../gcc/lto/lto-common.cc:2801 0x735356 lto_main() ../../gcc/lto/lto.cc:654 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. ```=