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

Sim compile errors on Ubuntu 22 and Oracle Linux 9.2 using gcc 11 #1556

Open
dandexter opened this issue Aug 29, 2023 · 2 comments
Open

Sim compile errors on Ubuntu 22 and Oracle Linux 9.2 using gcc 11 #1556

dandexter opened this issue Aug 29, 2023 · 2 comments
Labels
Canaries For issues that need to be addressed in the future ;-) Our Hands Are Tied

Comments

@dandexter
Copy link

dandexter commented Aug 29, 2023

I'm getting simulation compile errors on Ubuntu 22 LTS and Oracle Linux 9.2 and I think it is related to gcc 11.

I'm using the latest Trick from the repo on a fresh install of both Ubuntu 22 LTS and OL 9.2 using the Trick installation instructions. Also I am using the latest TrickHLA code from master.

The simulation does compile and link even with these errors. I think this is during ICG.

I show the simulation errors for both Ubuntu and OL below:

====================================
Ubuntu 22.04.3 LTS
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

In file included from /home/ddexter/projects/TrickHLA/sims/SpaceFOM/SIM_Roles_Test/S_source.hh:11:
In file included from /usr/include/c++/11/iostream:39:
In file included from /usr/include/c++/11/ostream:38:
In file included from /usr/include/c++/11/ios:42:
In file included from /usr/include/c++/11/bits/ios_base.h:41:
In file included from /usr/include/c++/11/bits/locale_classes.h:40:
In file included from /usr/include/c++/11/string:55:
In file included from /usr/include/c++/11/bits/basic_string.h:6608:
In file included from /usr/include/c++/11/ext/string_conversions.h:41:
In file included from /usr/include/c++/11/cstdlib:75:
/usr/include/stdlib.h:566:5: error: 'malloc' attribute takes no arguments
__attr_dealloc_free;
^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:691:30: note: expanded from macro '__attr_dealloc_free'

define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)

                         ^

/usr/include/x86_64-linux-gnu/sys/cdefs.h:690:21: note: expanded from macro '__attr_dealloc'
attribute ((malloc (dealloc, argno)))
^
In file included from /home/ddexter/projects/TrickHLA/sims/SpaceFOM/SIM_Roles_Test/S_source.hh:11:
In file included from /usr/include/c++/11/iostream:39:
In file included from /usr/include/c++/11/ostream:38:
In file included from /usr/include/c++/11/ios:42:
In file included from /usr/include/c++/11/bits/ios_base.h:41:
In file included from /usr/include/c++/11/bits/locale_classes.h:40:
In file included from /usr/include/c++/11/string:55:
In file included from /usr/include/c++/11/bits/basic_string.h:6608:
In file included from /usr/include/c++/11/ext/string_conversions.h:41:
In file included from /usr/include/c++/11/cstdlib:75:
/usr/include/stdlib.h:570:14: error: 'malloc' attribute takes no arguments
__THROW __attr_dealloc (reallocarray, 1);
^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:690:21: note: expanded from macro '__attr_dealloc'
attribute ((malloc (dealloc, argno)))
^

(not showing all the errors)

=======================================================
Red Hat Enterprise Linux release 9.2 (Plow)
gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4.3.0.1)

In file included from /home/ddexter/projects/TrickHLA/sims/SpaceFOM/SIM_Roles_Test/S_source.hh:11:
In file included from /usr/include/c++/11/iostream:39:
In file included from /usr/include/c++/11/ostream:38:
In file included from /usr/include/c++/11/ios:38:
In file included from /usr/include/c++/11/iosfwd:40:
In file included from /usr/include/c++/11/bits/postypes.h:40:
In file included from /usr/include/c++/11/cwchar:44:
/usr/include/wchar.h:155:24: error: 'malloc' attribute takes no arguments
attribute_malloc __attr_dealloc_free;
^
/usr/include/sys/cdefs.h:683:30: note: expanded from macro '__attr_dealloc_free'

define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)

                         ^

/usr/include/sys/cdefs.h:682:21: note: expanded from macro '__attr_dealloc'
attribute ((malloc (dealloc, argno)))
^
In file included from /home/ddexter/projects/TrickHLA/sims/SpaceFOM/SIM_Roles_Test/S_source.hh:11:
In file included from /usr/include/c++/11/iostream:39:
In file included from /usr/include/c++/11/ostream:38:
In file included from /usr/include/c++/11/ios:42:
In file included from /usr/include/c++/11/bits/ios_base.h:41:
In file included from /usr/include/c++/11/bits/locale_classes.h:40:
In file included from /usr/include/c++/11/string:55:
In file included from /usr/include/c++/11/bits/basic_string.h:6608:
In file included from /usr/include/c++/11/ext/string_conversions.h:41:
In file included from /usr/include/c++/11/cstdlib:75:
/usr/include/stdlib.h:565:5: error: 'malloc' attribute takes no arguments
__attr_dealloc_free;
^
/usr/include/sys/cdefs.h:683:30: note: expanded from macro '__attr_dealloc_free'

define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)

                         ^

/usr/include/sys/cdefs.h:682:21: note: expanded from macro '__attr_dealloc'
attribute ((malloc (dealloc, argno)))
^
(not showing all the errors)

@jdeans289
Copy link
Contributor

Yeah I agree that you probably shouldn't trust this in production even though it links, the io_src attributes are likely mangled. I'll investigate this and see if we can come up with a solution.

@keithvetter
Copy link
Contributor

I looked into this as part of this issue: #1553

Here is my last comment on #1553:

After much reading (and talking with ChatGPT!) I think the fix for the malloc error is in LLVM/clang's court. I think we'll just have to wait for a fix and live with the non-fatal error until LLVM/clang accomodate gcc 11's malloc attribute with arguments.

I see no workaround. The last comment I gave didn't work for S_source.hh.

Here is a post on the gcc11 change:
https://developers.redhat.com/blog/2021/04/30/detecting-memory-management-bugs-with-gcc-11-part-1-understanding-dynamic-allocation

Here are two open LLVM issues to fix it:
llvm/llvm-project#51607
llvm/llvm-project#53152

@hchen99 hchen99 added the Canaries For issues that need to be addressed in the future ;-) label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canaries For issues that need to be addressed in the future ;-) Our Hands Are Tied
Projects
None yet
Development

No branches or pull requests

5 participants