public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/97002] New: d: Promote types in d_type_promotes_to when linkage is not D
@ 2020-09-09 16:52 ibuclaw at gdcproject dot org
2020-09-12 19:43 ` [Bug d/97002] " cvs-commit at gcc dot gnu.org
2020-09-12 19:48 ` ibuclaw at gdcproject dot org
0 siblings, 2 replies; 3+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-09-09 16:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97002
Bug ID: 97002
Summary: d: Promote types in d_type_promotes_to when linkage is
not D
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
There is no promoting of variadic arguments when the linkage is D. However
extern(C) and extern(C++) functions do undergo type promotions.
This needs to be handled by d_type_promotes_to so that relevant warnings can be
issues on misuse of va_arg.
e.g:
import core.stdc.stdarg;
extern(C) int foo(short a, ...)
{
va_list ap;
va_start(ap, a);
auto f = va_arg!float(ap);
return cast(int)f;
}
int bar(short a, float f)
{
return foo(a, f); // passed as (double) f
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug d/97002] d: Promote types in d_type_promotes_to when linkage is not D
2020-09-09 16:52 [Bug d/97002] New: d: Promote types in d_type_promotes_to when linkage is not D ibuclaw at gdcproject dot org
@ 2020-09-12 19:43 ` cvs-commit at gcc dot gnu.org
2020-09-12 19:48 ` ibuclaw at gdcproject dot org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-12 19:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97002
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:707e9159ed25d19c174e4da18b194e530878d450
commit r11-3178-g707e9159ed25d19c174e4da18b194e530878d450
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Sat Sep 12 16:48:58 2020 +0200
d: Return promoted types in d_type_promotes_to when linkage is not D
This enables warnings to be shown when a bad type is passed to va_arg
inside an extern(C) or extern(C++) function.
gcc/d/ChangeLog:
PR d/97002
* d-codegen.cc (d_build_call): Set input_location on CALL_EXPR.
* d-lang.cc: Include function.h.
(d_type_promotes_to): Do default conversions for C and C++
functions.
* intrinsics.cc (expand_intrinsic_vaarg): Use build1_loc to build
VA_ARG_EXPR.
gcc/testsuite/ChangeLog:
PR d/97002
* gdc.dg/pr97002.d: New test.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug d/97002] d: Promote types in d_type_promotes_to when linkage is not D
2020-09-09 16:52 [Bug d/97002] New: d: Promote types in d_type_promotes_to when linkage is not D ibuclaw at gdcproject dot org
2020-09-12 19:43 ` [Bug d/97002] " cvs-commit at gcc dot gnu.org
@ 2020-09-12 19:48 ` ibuclaw at gdcproject dot org
1 sibling, 0 replies; 3+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-09-12 19:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97002
Iain Buclaw <ibuclaw at gdcproject dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Done.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-12 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 16:52 [Bug d/97002] New: d: Promote types in d_type_promotes_to when linkage is not D ibuclaw at gdcproject dot org
2020-09-12 19:43 ` [Bug d/97002] " cvs-commit at gcc dot gnu.org
2020-09-12 19:48 ` ibuclaw at gdcproject dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).