Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@moko256
Copy link
Contributor

@moko256 moko256 commented Jun 29, 2022

I found this when I was trying to enable to run impeller_unittests on Windows and saw some tests fail with SEH exceptions.
The execution order of arguments is different in GCC and MSVC Clang and MSVC.

This PR will fix code relying on this behavior.

Example
#include <sstream>
#include <iostream>

int gen_a() {
    int a = 10;
    std::cout << "Generating a as: " << a << std::endl;
    return a;
}

int gen_b() {
    int b = 20;
    std::cout << "Generating b as: " << b << std::endl;
    return b;
}

void all(int a, int b) {
    std::cout << "Final: " << a << " and " << b << std::endl;
}

/*
When compiled by MSVC or GCC, this will print:

Generating b as: 20
Generating a as: 10
Final: 10 and 20


When compiled by Clang, this will print:

Generating a as: 10
Generating b as: 20
Final: 10 and 20
*/
int main() {
    all(gen_a(), gen_b());
    return 0;
}

No changes in the flutter/tests repo.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa.

@chinmaygarde chinmaygarde added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 29, 2022
@auto-submit auto-submit bot merged commit 9e67369 into flutter:main Jun 29, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

affects: engine autosubmit Merge PR when tree becomes green via auto submit App e: impeller

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants