Comments (5)
The bug7
test is an example of a thread-specific TLD initializer that Berkeley UPC can handle, but clang-upc2c currently gets wrong.
The source contains:
extern int quux;
int * pquux = &quux;
[....]
int quux;
For which the Berkeley UPC translator generates code with an initializer appropriate only to the initial pthread (though no initializer is actually required at all):
extern int quux;
int* UPCR_TLD_DEFINE(pquux, 8, 8) = &quux;
int UPCR_TLD_DEFINE_TENTATIVE(quux, 4, 4);
PLUS the initialzier code which sets the right value for any thread:
void UPCRI_INIT_bug7_6953366925489(void) {
UPCR_BEGIN_FUNCTION();
UPCR_SET_SRCPOS("_bug7_6953366925489_INIT",0);
*((int* *) UPCR_TLD_ADDR(pquux)) = (int* )UPCR_TLD_ADDR(quux);
}
The translation from clang-upc2c attempts to perform the thread-specific initialization at file scope, and no initialization code:
int UPCR_TLD_DEFINE(quux, 4, 4);
int * UPCR_TLD_DEFINE(pquux, 8, 8) = &(*(int *)UPCR_TLD_ADDR(quux));
[...]
int UPCR_TLD_DEFINE(quux, 4, 4);
Also note that the "extern int quux" has been translated to a NON-tentative definition, which is probably not correct in general.
from upc2c.
This appears to be resolved by 4a3b381.
Since this issue is a regression relative to master (created and resolved on the branch) I am closing it.
from upc2c.
The dynamic initializers generated for pfoo
and pcrazy
in order to fix this issue are incorrect. So, I am reopenning this issue rather than creating a new one.
The current problem is that the TLD accessor macro does not appear on the LHS of the following:
pfoo = &((*(_cupc2c_tld0 *)UPCR_TLD_ADDR(foo))[2]);
pcrazy = &((*(_cupc2c_tld0 *)UPCR_TLD_ADDR(foo))[(&((*(_cupc2c_tld0 *)UPCR_TLD_ADDR(foo))[40]) - &((*(_cupc2c_tld0 *)UPCR_TLD_ADDR(foo))[30]))]);
The left-hand sides should also be expressions involving UPCR_TLD_ADDR().
from upc2c.
A possible fix is now in testing.
from upc2c.
Fixed in 59ca342
from upc2c.
Related Issues (20)
- TLD: static variable inside the function not promoted into global HOT 5
- TLD: bad code translation for initialized array HOT 5
- TLD: invalid code for anonymous union and struct types HOT 4
- TLD: UPCR_TLD_* macros must be at most one per line HOT 1
- TLD(RFE): implement an enable/disable switch for TLD HOT 1
- TLD: runtime regressions HOT 1
- TLD: missing TLD macros when accessing upcrt_forall_control HOT 5
- TLD: warning when 'extern' is used HOT 12
- TLD: Assertion failures inside Debug build HOT 2
- TLD: Assertion failures inside Release build HOT 1
- Undeclared __isoc99...scanf() functions in output HOT 6
- Problems w/ ___errno on Solaris HOT 16
- Bad translated output for attribute((transparent_union)) HOT 8
- 3.8 merge: Missing some brackets in struct initializers HOT 2
- Bad translation of pointer-to-shared as logical HOT 1
- Assertion failure translating complex.h on FreeBSD/i386 HOT 7
- crash on `sys/wait.h` from glibc 2.17 HOT 5
- cupc2c on MacOS X HOT 2
- Incorrect initializers for definite shared arrays HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upc2c.