public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Can gcc itself be tested with ubsan? If so, how?
@ 2021-09-27 23:00 Gary Oblock
  2021-09-28  6:35 ` Erick Ochoa
  0 siblings, 1 reply; 6+ messages in thread
From: Gary Oblock @ 2021-09-27 23:00 UTC (permalink / raw)
  To: gcc

I tried just adding "-fsanitize=undefined" to my CXX_FLAGS and got
a bunch of errors like this:

/usr/bin/ld: ../libcody/libcody.a(server.o): in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::~_Alloc_hider()':
/usr/include/c++/9/bits/basic_string.h:150: undefined reference to `__ubsan_handle_type_mismatch_v1'

They all seemed library related.

Can ubsan be used on the compiler itself?

Thanks,

Gary




CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Ampere Computing or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. Any unauthorized review, copying, or distribution of this email (or any attachments thereto) is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can gcc itself be tested with ubsan? If so, how?
  2021-09-27 23:00 Can gcc itself be tested with ubsan? If so, how? Gary Oblock
@ 2021-09-28  6:35 ` Erick Ochoa
  2021-09-28  6:47   ` Toon Moene
  0 siblings, 1 reply; 6+ messages in thread
From: Erick Ochoa @ 2021-09-28  6:35 UTC (permalink / raw)
  To: Gary Oblock; +Cc: gcc

Hi,

just as a note. This is also of interest to me. I have wanted to
compile a single pass that I wrote using ubsan/other sanitizers for
testing purposes. I was wondering if someone has already modified the
build system to use ubsan to test their passes and if they could
document the process for doing so. For these purposes, I don't really
care if it can be done only without bootstrapping. I haven't
investigated enough to find out if it is possible, but I suspect it is
and may have already been done.

Thanks!

On Tue, 28 Sept 2021 at 01:01, Gary Oblock via Gcc <gcc@gcc.gnu.org> wrote:
>
> I tried just adding "-fsanitize=undefined" to my CXX_FLAGS and got
> a bunch of errors like this:
>
> /usr/bin/ld: ../libcody/libcody.a(server.o): in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider::~_Alloc_hider()':
> /usr/include/c++/9/bits/basic_string.h:150: undefined reference to `__ubsan_handle_type_mismatch_v1'
>
> They all seemed library related.
>
> Can ubsan be used on the compiler itself?
>
> Thanks,
>
> Gary
>
>
>
>
> CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and contains information that is confidential and proprietary to Ampere Computing or its subsidiaries. It is to be used solely for the purpose of furthering the parties' business relationship. Any unauthorized review, copying, or distribution of this email (or any attachments thereto) is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can gcc itself be tested with ubsan? If so, how?
  2021-09-28  6:35 ` Erick Ochoa
@ 2021-09-28  6:47   ` Toon Moene
  2021-09-28 10:53     ` Eric Gallager
  2021-09-29 18:55     ` Gary Oblock
  0 siblings, 2 replies; 6+ messages in thread
From: Toon Moene @ 2021-09-28  6:47 UTC (permalink / raw)
  To: Erick Ochoa, Gary Oblock; +Cc: gcc

On 9/28/21 8:35 AM, Erick Ochoa via Gcc wrote:

>> Can ubsan be used on the compiler itself?

I regularly build the compiler(s) natively with ubsan enabled, see for 
instance:

https://gcc.gnu.org/pipermail/gcc-testresults/2021-September/719448.html

The configure line tells you how to do it (towards the end of the mail):

configure flags: --prefix=/home/toon/compilers/install/gcc --with-gnu-as 
--with-gnu-ld --enable-languages=all,ada --disable-multilib 
--disable-nls --with-build-config=bootstrap-ubsan --enable-checking=all

(the enable-checking part is not relevant, and can be omitted).

Kind regards,

-- 
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can gcc itself be tested with ubsan? If so, how?
  2021-09-28  6:47   ` Toon Moene
@ 2021-09-28 10:53     ` Eric Gallager
  2021-09-29 18:55     ` Gary Oblock
  1 sibling, 0 replies; 6+ messages in thread
From: Eric Gallager @ 2021-09-28 10:53 UTC (permalink / raw)
  To: Toon Moene; +Cc: Erick Ochoa, Gary Oblock, gcc

On Tue, Sep 28, 2021 at 2:48 AM Toon Moene <toon@moene.org> wrote:
>
> On 9/28/21 8:35 AM, Erick Ochoa via Gcc wrote:
>
> >> Can ubsan be used on the compiler itself?
>
> I regularly build the compiler(s) natively with ubsan enabled, see for
> instance:
>
> https://gcc.gnu.org/pipermail/gcc-testresults/2021-September/719448.html
>
> The configure line tells you how to do it (towards the end of the mail):
>
> configure flags: --prefix=/home/toon/compilers/install/gcc --with-gnu-as
> --with-gnu-ld --enable-languages=all,ada --disable-multilib
> --disable-nls --with-build-config=bootstrap-ubsan --enable-checking=all
>

To elaborate on that, to see what the --with-build-config=bootstrap-ubsan
configure flag does, you can check the file config/bootstrap-ubsan.mk

> (the enable-checking part is not relevant, and can be omitted).
>
> Kind regards,
>
> --
> Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
> Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can gcc itself be tested with ubsan? If so, how?
  2021-09-28  6:47   ` Toon Moene
  2021-09-28 10:53     ` Eric Gallager
@ 2021-09-29 18:55     ` Gary Oblock
  2021-10-01 20:11       ` Gary Oblock
  1 sibling, 1 reply; 6+ messages in thread
From: Gary Oblock @ 2021-09-29 18:55 UTC (permalink / raw)
  To: Toon Moene, Erick Ochoa; +Cc: gcc

Toon,

I assume the final compiler built this way has ubsan? I ask because
I'm trying to spot a bug in a new optimization so I want to
run it on a specific test case with the new optimization
enabled.

Thanks,

Gary

________________________________
From: Toon Moene <toon@moene.org>
Sent: Monday, September 27, 2021 11:47 PM
To: Erick Ochoa <eochoa@gcc.gnu.org>; Gary Oblock <gary@amperecomputing.com>
Cc: gcc@gcc.gnu.org <gcc@gcc.gnu.org>
Subject: Re: Can gcc itself be tested with ubsan? If so, how?

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]


On 9/28/21 8:35 AM, Erick Ochoa via Gcc wrote:

>> Can ubsan be used on the compiler itself?

I regularly build the compiler(s) natively with ubsan enabled, see for
instance:

https://gcc.gnu.org/pipermail/gcc-testresults/2021-September/719448.html

The configure line tells you how to do it (towards the end of the mail):

configure flags: --prefix=/home/toon/compilers/install/gcc --with-gnu-as
--with-gnu-ld --enable-languages=all,ada --disable-multilib
--disable-nls --with-build-config=bootstrap-ubsan --enable-checking=all

(the enable-checking part is not relevant, and can be omitted).

Kind regards,

--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Can gcc itself be tested with ubsan? If so, how?
  2021-09-29 18:55     ` Gary Oblock
@ 2021-10-01 20:11       ` Gary Oblock
  0 siblings, 0 replies; 6+ messages in thread
From: Gary Oblock @ 2021-10-01 20:11 UTC (permalink / raw)
  To: toon, erick.ochoa, gcc

I suppose I should answer my own question....

Yes, the final compiler built has ubsan enabled.

Gary

PS. The faint hearted should note this is an overnight build. It would be nice if this wasn't tied to building a bootstrap compiler.

________________________________
From: Gary Oblock <gary@amperecomputing.com>
Sent: Wednesday, September 29, 2021 11:55 AM
To: Toon Moene <toon@moene.org>; Erick Ochoa <eochoa@gcc.gnu.org>
Cc: gcc@gcc.gnu.org <gcc@gcc.gnu.org>
Subject: Re: Can gcc itself be tested with ubsan? If so, how?

Toon,

I assume the final compiler built this way has ubsan? I ask because
I'm trying to spot a bug in a new optimization so I want to
run it on a specific test case with the new optimization
enabled.

Thanks,

Gary

________________________________
From: Toon Moene <toon@moene.org>
Sent: Monday, September 27, 2021 11:47 PM
To: Erick Ochoa <eochoa@gcc.gnu.org>; Gary Oblock <gary@amperecomputing.com>
Cc: gcc@gcc.gnu.org <gcc@gcc.gnu.org>
Subject: Re: Can gcc itself be tested with ubsan? If so, how?

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please be mindful of safe email handling and proprietary information protection practices.]


On 9/28/21 8:35 AM, Erick Ochoa via Gcc wrote:

>> Can ubsan be used on the compiler itself?

I regularly build the compiler(s) natively with ubsan enabled, see for
instance:

https://gcc.gnu.org/pipermail/gcc-testresults/2021-September/719448.html

The configure line tells you how to do it (towards the end of the mail):

configure flags: --prefix=/home/toon/compilers/install/gcc --with-gnu-as
--with-gnu-ld --enable-languages=all,ada --disable-multilib
--disable-nls --with-build-config=bootstrap-ubsan --enable-checking=all

(the enable-checking part is not relevant, and can be omitted).

Kind regards,

--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-01 20:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 23:00 Can gcc itself be tested with ubsan? If so, how? Gary Oblock
2021-09-28  6:35 ` Erick Ochoa
2021-09-28  6:47   ` Toon Moene
2021-09-28 10:53     ` Eric Gallager
2021-09-29 18:55     ` Gary Oblock
2021-10-01 20:11       ` Gary Oblock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).