<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - in C double and _Float64 mist be destinct types (and float and _Float32)"
href="https://bugs.llvm.org/show_bug.cgi?id=50766">50766</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>in C double and _Float64 mist be destinct types (and float and _Float32)
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>12.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>aaron_ng@inode.at
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>In C double and _Float64 are destinct types always.
In C float and _Float32 are destinct types always.
In _Float32 must NOT promote to double.
I have the definitive response from the sc22wg14 mailing list confirming
above statements.
Since the mailing list is not public I cannot sent the answer here.
x86-64 clang 12.0.0, icc 19.01 and tcc (unknown version) fail to compile
following program, but gcc 9.2.1 succeeds:
#include <stdio.h>
#include <math.h>
#define PGFN(name) _Generic((name), \
float: printf("%s():" #name "=%f\n",__func__,name), \
double: printf("%s():" #name "=%f\n",__func__,name), \
default: printf("%s():" #name "=[unknown type]\n",__func__),\
_Float32:printf("%s():" #name "=%f\n",__func__,((double)name)), \
_Float64:printf("%s():" #name "=%f\n",__func__,name) \
)
int main(int argc,char *argv[]){
float f=4.0;
double d=8.0;
_Float32 f32=32.0;
_Float64 f64=64.0;
(void)argc,(void)argv;
PGFN(f);
PGFN(d);
PGFN(f32);
PGFN(f64);
return 0;
}</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>