https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82391
Bug ID: 82391 Summary: [openacc] acc_on_device not folded at -O0 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- The openacc spec states: "If the acc_on_device routine has a compile-time constant argument, it evaluates at compile time to a constant." This is not the case at -O0. At f.i. -O2, the folding is done by gimple_fold_builtin_acc_on_device. This folds the builtin for all arguments, not just constant. Further optimizations/folding propagate the constant argument to a situation where the the acc_on_device routine is reduced to a compile time constant.