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

clang zero-initializing what it should be value-initializing #10173

Closed
llvmbot opened this issue Apr 27, 2011 · 3 comments
Closed

clang zero-initializing what it should be value-initializing #10173

llvmbot opened this issue Apr 27, 2011 · 3 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 27, 2011

Bugzilla Link 9801
Resolution FIXED
Resolved on Apr 28, 2011 13:57
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor,@rjmccall

Extended Description

Consider this simple testcase:

extern "C" { int printf(const char *format, ...); };

struct Test {
Test() : i(10) {}
Test(int i) : i(i) {}
int i;
private:
int j;
};

int main() {
Test partial[3] = { 1 };
printf("%d %d %d\n", partial[0].i, partial[1].i, partial[2].i);

Test empty[3] = {};
printf("%d %d %d\n", empty[0].i, empty[1].i, empty[2].i);

}

This is a regression; as of r129729 it worked. The program should print "1 10 10" "10 10 10". It currently prints "1 10 10" "0 0 0".

If you shrink the array down to 2 members, the bug goes away. If you remove private members, the bug goes away.

@DougGregor
Copy link
Contributor

Clang r129896 and r129933 made changes in this area.

@DougGregor
Copy link
Contributor

cloned to rdar://problem/9347552

@akyrtzi
Copy link
Contributor

akyrtzi commented Apr 28, 2011

FIxed at r130421, thanks for the report!

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 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 c++
Projects
None yet
Development

No branches or pull requests

3 participants