-
Notifications
You must be signed in to change notification settings - Fork 7.3k
toolchain: __used macro for GCC clashes with host (glibc) regex structure (when building for native_posix) #55593
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
Comments
This issue is not only for ztest, so updated name on issue. I've debugged the code and the issue seems to happen on return from regcomp, inside regcomp everything looks fine. I found this odd thing.
In regcomp itself (&re is passed as *preg):
|
While playing around it started to work when the include files was reordered. Fails:
Works:
|
Ok, I think I have found the actual issue now by bisecting the includes. The error happens if this line in <zephyr/toolchain/gcc.h> To see why, let's look at the field __re_long_size_t:
__REPB_PREFIX is expanded by The __used is expanded by the line in gcc.h to This snippet illustrates the result:
Output:
|
Workaround for this is to always include regex.h before any zephyr headers. |
Thanks for the detailed analysis in #55593 (comment). As explained in the comment above, the issue has to do with an implementation detail of the (host) glibc I am inclined to mark and close this as a known issue because:
|
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
Based on the same reasoning as #55593 (comment) I would also be inclined to close this as "won't fix". |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
Describe the bug
When trying to test code using regexps I discovered that when running under ztest the group matching did not work for posix target. Update: see this comment for details and reproduction.
A minimal test case is this snippet:
My observations are:
a) If this is run as a standalone program, re.re_nsub will correctly be 1
b) If this code is run as a part of a ztest, re.re_nsub will equal 0 (any subsequent matching will fail)
c) If this code is run as a part of a test, but in an external function, it will correctly be 1
d) If this code is run as a part of a test, but from a function defined in the test file, there will be a *** stack smashing detected ***: terminated
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect regex to work correctly.
Logs and console output
*** Inconsistent regcomp ***
Smash stacking issue
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: