Wind River Support Network

HomeDefectsLIN8-7299
Fixed

LIN8-7299 : Compiler produces incorrect code with optimization level Os Used

Created: Aug 9, 2017    Updated: Dec 3, 2018
Resolved Date: Oct 27, 2017
Found In Version: 8.0.0.19
Fix Version: 8.0.0.23
Severity: Standard
Applicable for: Wind River Linux 8
Component/s: Toolchain

Description

Using optimization -Os and -O2 gives different result when the OR operation is used, on a ppc CPUs

Workaround

Use -fno-expensive-optimizations option to disable the pass that introduces the error.

Steps to Reproduce

1. create a build with ppc 
wrlinux-8/wrlinux/configure --enable-rootfs=glibc-std --enable-board=qemuppc --with-rcpl-version=0019
2. create an image
make 
3. export sdk
make export-sdk
4. source sdk script
mkdir SDK
cd SDK 
./wrlinux-8.0.0.19-glibc-x86_64-qemuppc-wrlinux-image-glibc-std-sdk.sh
5. source sdk environment
source env.sh
6. compile the optimization_problem.cpp with -Os
7. compile the optimization_problem.cpp with -O2

compare output (correct output should be 0x20001) with 
-O2 output: 0x20001
-Os output: 0x2

############################################################
Compile line for -O2:
powerpc-wrs-linux-g++ -g -Wall -m32 -mhard-float -mcpu=603e -std=c++11 -g -fstack-check -fstack-protector -DMOST_SIGNIFICANT_BIT_FIRST -MD -D__LINUX  -Wno-uninitialized -mstrict-align -DCPU=ppc7400 -D_DEBUG -fno-inline --sysroot=/hbustost/cases/00075318_qemuppc_lx8/SDK/sysroots/ppc7400-wrs-linux  -I/hbustost/cases/00075318_qemuppc_lx8/SDK/sysroots/ppc7400-wrs-linux/usr/include/ -o optimization_problem_all_O2 optimization_problem.cpp

Compile line for -Os:
powerpc-wrs-linux-g++ -Os -g -Wall -m32 -mhard-float -mcpu=603e -std=c++11 -g -fstack-check -fstack-protector -DMOST_SIGNIFICANT_BIT_FIRST -MD -D__LINUX  -Wno-uninitialized -mstrict-align -DCPU=ppc7400 -D_DEBUG -fno-inline --sysroot=/hbustost/cases/00075318_qemuppc_lx8/SDK/sysroots/ppc7400-wrs-linux  -I/hbustost/cases/00075318_qemuppc_lx8/SDK/sysroots/ppc7400-wrs-linux/usr/include/ -o optimization_problem_OS optimization_problem.cpp

Other Downloads


Live chat
Online