public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105514] New: rv64 qsort gets wrong result when '-O2 -DDEBUG'.
@ 2022-05-07  9:56 chenglulu at loongson dot cn
  2022-05-07 10:49 ` [Bug target/105514] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: chenglulu at loongson dot cn @ 2022-05-07  9:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105514
           Summary: rv64 qsort gets wrong result when '-O2 -DDEBUG'.
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chenglulu at loongson dot cn
  Target Milestone: ---

Created attachment 52936
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52936&action=edit
riscv64-linux-gnu

%riscv64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=riscv64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/.../libexec/gcc/riscv64-linux-gnu/13.0.0/lto-wrapper
Target: riscv64-linux-gnu
Configured with: /.../configure --target=riscv64-linux-gnu --with-arch=rv64g
--with-abi=lp64d --enable-shared --disable-emultls --disable-bootstrap
--enable-languages=c,c++,fortran --disable-multilib 
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20220507 (experimental) (GCC) 

There is no problem with the execution result of the following compiler.
% riscv64-linux-gnu-gcc qsort.c -o qsort -O2 --static -march=rv64g -mabi=lp64d
% ./qsort
./qsort 

But, When I add a line to the code to print,program execution result is wrong.
% riscv64-linux-gnu-gcc qsort.c -o qsort -O2 --static -march=rv64g -mabi=lp64d
-DDEBUG
./qsort 





test simple_qsort array with function pointer failed.

When add option '-DDEBUG -fno-reorder-blocks', The program execution result is
no problem again.

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

end of thread, other threads:[~2022-05-12  2:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-07  9:56 [Bug c/105514] New: rv64 qsort gets wrong result when '-O2 -DDEBUG' chenglulu at loongson dot cn
2022-05-07 10:49 ` [Bug target/105514] " pinskia at gcc dot gnu.org
2022-05-09  1:19 ` chenglulu at loongson dot cn
2022-05-09  8:06 ` rguenth at gcc dot gnu.org
2022-05-12  2:10 ` chenglulu at loongson dot cn
2022-05-12  2:29 ` 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).