https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71053
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P4 |P3
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-06-08
Component|target |c++
CC| |gjl at gcc dot gnu.org
Host|x86_64-apple-darwin15 |x86_64
Ever confirmed|0 |1
Known to fail| |7.0
Build|x86_64-apple-darwin15 |
--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #1)
> On x86_64 I get
>
> main:
> .LFB0:
> .cfi_startproc
> .L2:
> movb 1, %al
> testb $1, %al
> je .L2
> xorl %eax, %eax
> ret
>
> and thus it works fine there. Target issue.
Sorry, I cannot follow your argument. Test case:
#define REG (*(unsigned char volatile*)0x31)
void foo ()
{
while ((REG & 1) == 1);
}
worsks fine then compiled as C, but for C++
$ avr-gcc -x c++ foo.c -S -Os -fdump-tree-all
I see the following .ssa dump:
;; Function void foo() (_Z3foov, funcdef_no=0, decl_uid=1976, cgraph_uid=0,
symbol_order=0)
void foo() ()
{
volatile unsigned char * _1;
unsigned char _2;
int _3;
int _4;
bool retval.0_6;
<bb 2>:
_1 = 49B;
_2 = *_1;
_3 = (int) _2;
_4 = _3 & 1;
retval.0_6 = _4 != 0;
if (retval.0_6 != 0)
goto <bb 2>;
else
goto <bb 3>;
<bb 3>:
return;
}
The dump is missing a {v} qualifier which is present in the dump generated for
C code:
...
_2 ={v} *_1;
...
The missing qualifier results in the mentioned wrong optimization in load
invariant motion, see .lim2 dump.
I used avr-gcc built from trunk SVN 236978 from 2016-06-11:
$ ../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/local/gnu/install/gcc-7 --disable-shared --disable-nls --with-dwarf2
--enable-target-optspace=yes --with-gnu-as --with-gnu-ld target_alias=avr
--enable-languages=c,c++,lto