Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

9495: Fixes issue with variadic functions on win64 #1657

Merged
merged 4 commits into from

4 participants

Ingrater Walter Bright Shahid Martin Nowak
Ingrater

Which only appears if the argument before the variadic arguments is > 8 byte
http://d.puremagic.com/issues/show_bug.cgi?id=9495

Walter Bright

Please add test case.

Shahid

@Ingrater could you rebase this pull request into just 2 commits, the change and the testsuite code?
it makes the git history look alot cleaner.

Ingrater

Are there some instructions around how to do that?

Shahid

1) To redo commits, I use interactive mode "git rebase -i <last good commit>"
2) instead of merging upstream/master, rebase your commits over it

git checkout pull9495
git fetch upstream
git rebase upstream/master

Note: when you push you'll have to --force

Martin Nowak
Collaborator

test9495 should not be compiled with -release

Why?

Ingrater

Because the asserts are gone then?

Walter Bright WalterBright merged commit 76b8f79 into from
Deleted user Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Deleted user Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 12, 2013
  1. Ingrater

    Fixes issue with variadic functions on win64 if the argument before t…

    Ingrater authored
    …he variadic function is > 8 byte (issue 9495)
Commits on Feb 22, 2013
  1. Ingrater
  2. Ingrater

    -Added test case for bug 9495

    Ingrater authored
    -Using Target::ptrsize instead of hardcoded constant
Commits on Feb 23, 2013
  1. Ingrater
This page is out of date. Refresh to see the latest.
Showing with 32 additions and 1 deletion.
  1. +1 −1  src/func.c
  2. +31 −0 test/runnable/test9495.d
2  src/func.c
View
@@ -1501,7 +1501,7 @@ void FuncDeclaration::semantic3(Scope *sc)
p = v_arguments; // last parameter is _arguments[]
if (global.params.is64bit && global.params.isWindows)
{ offset += Target::ptrsize;
- if (p->storage_class & STClazy)
+ if (p->storage_class & STClazy || p->type->size() > Target::ptrsize)
{
/* Necessary to offset the extra level of indirection the Win64
* ABI demands
31 test/runnable/test9495.d
View
@@ -0,0 +1,31 @@
+// PERMUTE_ARGS:
+
+import core.vararg;
+
+int func1(int a, ...)
+{
+ auto result = va_arg!int(_argptr);
+ return result;
+}
+
+void test9495a()
+{
+ assert(func1(5, 12345678) == 12345678);
+}
+
+int func2(const(char)[] a, ...)
+{
+ auto result = va_arg!int(_argptr);
+ return result;
+}
+
+void test9495b()
+{
+ assert(func2("5", 12345678) == 12345678);
+}
+
+void main(string[] args)
+{
+ test9495a();
+ test9495b();
+}
Something went wrong with that request. Please try again.