Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Offset not zero at the point of scalar access #34340

Closed
dyung opened this issue Oct 18, 2017 · 6 comments
Closed

Fatal error: Offset not zero at the point of scalar access #34340

dyung opened this issue Oct 18, 2017 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla

Comments

@dyung
Copy link
Collaborator

dyung commented Oct 18, 2017

Bugzilla Link 34992
Resolution FIXED
Resolved on Oct 31, 2017 14:39
Version trunk
OS Linux
CC @kosarev,@RKSimon
Fixed by commit(s) rL316211

Extended Description

Following r315984, one of our internal tests started to fail with the following error from the compiler:

Offset not zero at the point of scalar access
%2 = load float, float* %india, align 4, !tbaa !​6
!​6 = !{#7, !​9, i64 4}
4
fatal error: error in backend: Broken function found, compilation aborted!

You can reproduce this by compiling the following code with optimization’s enabled:

Clang -cc1 -emit-obj -O2 reduced.cpp

Where reduced.cpp is the following code:

/* reduced.cpp /
class alpha;
namespace bravo {
namespace charlie {
void delta(alpha
element, char* name, float var);
}

namespace foxtrot {
class gulf { public: float hotel; float india; };
class juliet { public: gulf kilo[4]; };
}

namespace charlie {
class lima { public: bravo::foxtrot::juliet mike; };
void november( alpha* oscar, lima * papa ) {
alpha* quebec ;
delta(quebec, "romeo", papa->mike.kilo->india);
}
}
}

Thanks to Sunil for helping reduce this test for me.

@dyung
Copy link
Collaborator Author

dyung commented Oct 18, 2017

assigned to @kosarev

@kosarev
Copy link
Collaborator

kosarev commented Oct 18, 2017

A minimized test:

struct A { int x; };
struct B { A a[1]; };

int bar(B *b) {
return b->a->x;
}

Apparently the problem is how we handle array-to-pointer decays.

@kosarev
Copy link
Collaborator

kosarev commented Oct 19, 2017

The patch:
https://reviews.llvm.org/D39083

@kosarev
Copy link
Collaborator

kosarev commented Oct 20, 2017

Resolved in:
[CodeGen] Fix generation of TBAA info for array-to-pointer conversions
https://reviews.llvm.org/rL316211

@kosarev
Copy link
Collaborator

kosarev commented Oct 30, 2017

Douglas, can you please confirm the fix works for you?

@dyung
Copy link
Collaborator Author

dyung commented Oct 31, 2017

Douglas, can you please confirm the fix works for you?

Hi Ivam, I can confirm that this fixes the internal test that uncovered the issue. Thanks for fixing it!

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

2 participants