Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#pragma pack(1) breaks Function Return Value Sequences #107

Open
alexsconway opened this issue Feb 28, 2022 · 1 comment
Open

#pragma pack(1) breaks Function Return Value Sequences #107

alexsconway opened this issue Feb 28, 2022 · 1 comment

Comments

@alexsconway
Copy link

alexsconway commented Feb 28, 2022

Describe the bug
I'm using Ceedling with Unity and FFF to unit test some embedded code.
To make some things work I need to specify #pragma pack(1) for some structures.
I was trying to mock a sequence of return values for a function and the results were not as expected.
Some hours later I have trimmed it down to a minimal reproduction case:

To Reproduce
make sure you have Ceedling and FFF set up etc... This was on Windows 10 with MinGW
Unzip the TestFFFseq.zip, start a command prompt in the TestFFFseq folder and run
ceedling test:all

the result will be

FAILED TEST SUMMARY

[test_FFFseq.c]
Test: test_One
At line (28): "Expected 1 Was 0"

OVERALL TEST SUMMARY

TESTED: 1
PASSED: 0
FAILED: 1
IGNORED: 0

Expected behavior

OVERALL TEST SUMMARY

TESTED: 1
PASSED: 1
FAILED: 0
IGNORED: 0

Compiler, toolset, platform (please complete the following information):

  • Windows 10 Home
  • MinGW, Ceedling 0.31.1, latest FFF (Feb 2022)

If one comments out the #pragma pack(1) on line 3 of test_FFFseq.c then the test passes.

I tried but couldn't reproduce without Ceedling generating the fake.

This can be avoided by using #pragma pack(push, 1) and #pragma pack(pop) where one needs it in one's code

TestFFFseq.zip

@samthode
Copy link

samthode commented Jun 20, 2022

Thanks for posting this. Just spent 5 hours debugging a non sense issue. Turns out it was b/c pragma pack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants