<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - missing default argument promotion"
href="https://llvm.org/bugs/show_bug.cgi?id=28046">28046</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>missing default argument promotion
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vries@gcc.gnu.org
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Consider test.c, compiled with -std=c99:
...
extern void foo();
void bar() {
foo(1, 2);
}
void foo(d, e)
int d;
unsigned int e;
{}
void bar2() {
foo(3, 4);
}
...
With -ast-dump we get:
...
|-FunctionDecl 0xb90bd38 <test.c:62:1, col:17> col:13 used foo 'void ()' extern
|-FunctionDecl 0xb957990 <line:64:1, line:66:1> line:64:6 bar 'void ()'
| `-CompoundStmt 0xb957b30 <col:12, line:66:1>
| `-CallExpr 0xb957af0 <line:65:3, col:11> 'void'
| |-ImplicitCastExpr 0xb957ad8 <col:3> 'void (*)()'
<FunctionToPointerDecay>
| | `-DeclRefExpr 0xb957a48 <col:3> 'void ()' Function 0xb90bd38 'foo'
'void ()'
| |-IntegerLiteral 0xb957a70 <col:7> 'int' 1
| `-IntegerLiteral 0xb957a90 <col:10> 'int' 2
|-FunctionDecl 0xb957ca0 prev 0xb90bd38 <line:68:1, line:71:2> line:68:6 used
foo 'void (int, unsigned int)'
| |-ParmVarDecl 0xb957b60 <line:69:6, col:10> col:10 d 'int'
| |-ParmVarDecl 0xb957bd0 <line:70:6, col:19> col:19 e 'unsigned int'
| `-CompoundStmt 0xb957d68 <line:71:1, col:2>
`-FunctionDecl 0xb957da0 <line:73:1, line:75:1> line:73:6 bar2 'void ()'
`-CompoundStmt 0xb957f30 <col:13, line:75:1>
`-CallExpr 0xb957ed8 <line:74:3, col:11> 'void'
|-ImplicitCastExpr 0xb957ec0 <col:3> 'void (*)()'
<FunctionToPointerDecay>
| `-DeclRefExpr 0xb957e58 <col:3> 'void ()' Function 0xb957ca0 'foo'
'void (int, unsigned int)'
|-IntegerLiteral 0xb957e80 <col:7> 'int' 3
`-ImplicitCastExpr 0xb957f18 <col:10> 'unsigned int' <IntegralCast>
`-IntegerLiteral 0xb957ea0 <col:10> 'int' 4
...
The cast to unsigned int for argument 4 is not standard-compliant. Foo is a
function without prototype, so the arguments get default argument promotion,
which implies that the type of the argument should be int rather than unsigned
int.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>