Skip to content

misoptimization with defaulting to POWER7 and newer #45054

@pkubaj

Description

@pkubaj
Bugzilla Link 45709
Resolution FIXED
Resolved on Jun 22, 2020 15:47
Version trunk
OS FreeBSD
Blocks #44654
CC @adalava,@DimitryAndric,@MaskRay,@nemanjai,@tstellar
Fixed by commit(s) 793cc51 eac91d5

Extended Description

Reduced test case:
class a {
void b();
void m_fn2();
int c;
float d[];
};
void a ::b() {
float e;
for (int f; f <= c; f++)
if (e < d[f])
e = d[f];
if (e)
m_fn2();
}

Compile with:
c++ -ffast-math -O2 -c sms.cpp

It builds fine without -ffast-math, or when lowering optimizations to -O1, or after adding -mcpu=power7 (power8 or power9 are also ok for clang).

Result:
Illegal instruction

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions