[LLVMbugs] [Bug 14954] New: problem checking for invalid attribute parameters
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jan 14 13:29:38 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=14954
Bug #: 14954
Summary: problem checking for invalid attribute parameters
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rkotler at mips.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
It seems that almost uniformly, checking for the presence of unwanted attribute
parameters is done incorrectly.
For example, if you compile a program with the following for an x86 target,
there will be no warnings.
void __attribute__((force_align_arg_pointer(foo))) p();
The reason for this is that the error condition is being checked as follows:
if (Attr.getNumArgs() != 0) {
S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments)
<< 0;
return;
}
Whereas the check should be
if (Attr.hasParameterOrArguments()) {
An attribute with a single parameter (unless it is a number like for aligned)
is treated as a parameter and not part of a list of arguments.
So when there is a single parameter, #args is still 0.
/// AttributeList - Represents GCC's __attribute__ declaration. There are
/// 4 forms of this construct...they are:
///
/// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
/// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
/// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
/// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list