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

declaration of vars with undefined structured type is rejected #3682

Closed
llvmbot opened this issue Jan 10, 2009 · 8 comments
Closed

declaration of vars with undefined structured type is rejected #3682

llvmbot opened this issue Jan 10, 2009 · 8 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jan 10, 2009

Bugzilla Link 3310
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@efriedma-quic,@nunoplopes

Extended Description

We scanned our firmware coreboot (See http://www.coreboot.org/) and it finds 11 analyzer failures. Complete logs are at http://www.coresystems.de/~patrick/scan-build-2009-01-09-1/

Please let me know if you need more information

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 10, 2009

assigned to @DougGregor

@nunoplopes
Copy link
Member

the parser rejects are all reduced to this simple test case:

struct foo bar;

'gcc -fsyntax-only' accepts this with no warning (weird..), while clang rejects it.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 15, 2009

This is invalid code per C99 6.7p7.

Note that, for example,

extern struct foo bar;
void *p = &bar;

is legal and clang accepts this.

Doug, you made a comment indicating you thought this was legal. It is true that if this was a legal declaration this would be a tentative definition, however my reading is that this isn't a legal declaration.

Do you agree?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Jan 18, 2009

*** Bug llvm/llvm-bugzilla-archive#3349 has been marked as a duplicate of this bug. ***

@efriedma-quic
Copy link
Collaborator

the parser rejects are all reduced to this simple test case:

struct foo bar;

'gcc -fsyntax-only' accepts this with no warning (weird..), while clang
rejects it.

I think you reduced that a bit too much... that's actually a bug in gcc's "-fsyntax-only". Try "gcc -S -o /dev/null" instead.

@efriedma-quic
Copy link
Collaborator

Proper reduced testcase:

struct a x;
struct a {int x;};

And as far as I can tell, this is actually legal; 6.7p7 doesn't apply here because x has linkage.

@DougGregor
Copy link
Contributor

@llvmbot
Copy link
Collaborator Author

llvmbot commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#3349

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this issue Dec 14, 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 clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

4 participants