public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mxlol233 at outlook dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-111937-4-641EA0XHKs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-111937-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Xiao Ma <mxlol233 at outlook dot com> ---
Created attachment 56185
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56185&action=edit
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=rvgpu-none
--enable-languages=c --enable-as-accelerator-for=x86_64-pc-linux-gnu && make
all-gcc -j16
5. cd ../
6. mkdir .build_host && cd .build_host && ../configure --enable-languages=c
--enable-offload-targets=rvgpu-none=`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 = 0, r = 0, l2 = 0;
  int a[3][3][3];


  #pragma acc parallel
  #pragma acc loop collapse(4 - 1)
    for (int i = 0; i < 2; i++)
      for (int j = 0; j < 2; j++)
        for (int k = 0; k < 2; k++)
          a[i][j][k] = i + j * 4 + k * 16;
#pragma acc parallel
    {
      #pragma acc loop collapse(2) reduction(|:l)
        for (i2 = 0; i2 < 2; i2++)
          for (int j = 0; j < 2; j++)
            for (int k = 0; k < 2; k++)
              if (a[i2][j][k] != i2 + j * 4 + k * 16)
                l += 1;
    }

  /*  Test loop with >= condition.  */
#pragma acc parallel
    {
      #pragma acc loop collapse(2) reduction(|:l2)
        for (i2 = 0; i2 < 2; i2++)
          for (int j = 1; j >= 0; j--)
            for (int k = 0; k < 2; k++)
              if (a[i2][j][k] != i2 + j * 4 + k * 16)
                l2 += 1;
    }

    for (i2 = 0; i2 < 2; i2++)
      for (int j = 0; j < 2; j++)
        for (int k = 0; k < 2; k++)
          if (a[i2][j][k] != i2 + j * 4 + k * 16)
            r += 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=1
```
10. as --64 -o a.o a.s

11. ../.build_accel/gcc/lto1 -quiet  -o a.o.s a.o                               
# you will see the log like this:
```
NUM_POLY_INT_COEFFS=2
‘
Segmentation fault
0xbf3e83 crash_signal
        ../../gcc/toplev.cc:314
0x7f92986f608f ???
       
/build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.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 <https://gcc.gnu.org/bugs/> for instructions.
```

  parent reply	other threads:[~2023-10-24  5:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 14:06 [Bug target/111937] New: " mxlol233 at outlook dot com
2023-10-23 17:12 ` [Bug target/111937] " tschwinge at gcc dot gnu.org
2023-10-24  1:55 ` mxlol233 at outlook dot com
2023-10-24  5:42 ` mxlol233 at outlook dot com [this message]
2023-10-24  7:27 ` rguenth at gcc dot gnu.org
2023-10-24  7:39 ` mxlol233 at outlook dot com
2024-04-09  1:14 ` pinskia at gcc dot gnu.org
2024-04-09  1:15 ` [Bug target/111937] offloading from x86_64-linux-gnu to riscv*-linux-gnu will have issues pinskia 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-111937-4-641EA0XHKs@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).