Git Product home page Git Product logo

Comments (5)

PHHargrove avatar PHHargrove commented on August 30, 2024

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.

PHHargrove avatar PHHargrove commented on August 30, 2024

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.

PHHargrove avatar PHHargrove commented on August 30, 2024

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.

PHHargrove avatar PHHargrove commented on August 30, 2024

A possible fix is now in testing.

from upc2c.

PHHargrove avatar PHHargrove commented on August 30, 2024

Fixed in 59ca342

from upc2c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.