* [PATCH] tree-optimization/103456 - Record only successes from object_sizes_set
@ 2021-12-01 4:17 Siddhesh Poyarekar
2021-12-01 7:18 ` Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Siddhesh Poyarekar @ 2021-12-01 4:17 UTC (permalink / raw)
To: gcc-patches; +Cc: jakub, Martin Liška
Avoid overwriting osi->changed if object_sizes_set does not update the
size, so that a previous success in the same pass is not overwritten.
This fixes the bootstrap-ubsan build config, which was failing due to
incorrect object size.
Also completed a bootstrap on x86_64 which didn't show any new failures.
gcc/ChangeLog:
PR tree-optimization/103456
* tree-object-size.c (merge_object_sizes): Update osi->changed
only if object_sizes_set succeeded.
gcc/testsuite/ChangeLog:
PR tree-optimization/103456
* gcc.dg/pr103456.c: New test.
Co-authored-by: Martin Liška <mliska@suse.cz>
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
---
gcc/testsuite/gcc.dg/pr103456.c | 21 +++++++++++++++++++++
gcc/tree-object-size.c | 3 ++-
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/pr103456.c
diff --git a/gcc/testsuite/gcc.dg/pr103456.c b/gcc/testsuite/gcc.dg/pr103456.c
new file mode 100644
index 00000000000..20322fbaab1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr103456.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/103456 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -O -fdump-tree-objsz" } */
+
+static char *multilib_options = "m64/m32";
+
+void
+used_arg_t (void)
+{
+ char *q = multilib_options;
+ for (;;)
+ {
+ while (*q)
+ q++;
+ while (__builtin_strchr (q, '_') == 0)
+ while (*q)
+ q++;
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "maximum object size 0" "objsz1" } } */
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 3780437ff91..b4881ef198f 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -854,7 +854,8 @@ merge_object_sizes (struct object_size_info *osi, tree dest, tree orig,
orig_bytes = (offset > orig_bytes)
? HOST_WIDE_INT_0U : orig_bytes - offset;
- osi->changed = object_sizes_set (osi, varno, orig_bytes);
+ if (object_sizes_set (osi, varno, orig_bytes))
+ osi->changed = true;
return bitmap_bit_p (osi->reexamine, SSA_NAME_VERSION (orig));
}
--
2.31.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tree-optimization/103456 - Record only successes from object_sizes_set
2021-12-01 4:17 [PATCH] tree-optimization/103456 - Record only successes from object_sizes_set Siddhesh Poyarekar
@ 2021-12-01 7:18 ` Jakub Jelinek
2021-12-01 8:31 ` [COMMITTED] " Siddhesh Poyarekar
0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2021-12-01 7:18 UTC (permalink / raw)
To: Siddhesh Poyarekar; +Cc: gcc-patches, Martin Liška
On Wed, Dec 01, 2021 at 09:47:21AM +0530, Siddhesh Poyarekar wrote:
> Avoid overwriting osi->changed if object_sizes_set does not update the
> size, so that a previous success in the same pass is not overwritten.
> This fixes the bootstrap-ubsan build config, which was failing due to
> incorrect object size.
>
> Also completed a bootstrap on x86_64 which didn't show any new failures.
>
> gcc/ChangeLog:
>
> PR tree-optimization/103456
> * tree-object-size.c (merge_object_sizes): Update osi->changed
> only if object_sizes_set succeeded.
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/103456
> * gcc.dg/pr103456.c: New test.
>
> Co-authored-by: Martin Liška <mliska@suse.cz>
> Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
> ---
> gcc/testsuite/gcc.dg/pr103456.c | 21 +++++++++++++++++++++
> gcc/tree-object-size.c | 3 ++-
> 2 files changed, 23 insertions(+), 1 deletion(-)
> create mode 100644 gcc/testsuite/gcc.dg/pr103456.c
>
> diff --git a/gcc/testsuite/gcc.dg/pr103456.c b/gcc/testsuite/gcc.dg/pr103456.c
> new file mode 100644
> index 00000000000..20322fbaab1
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/pr103456.c
With -fsanitize=undefined that testcase belongs to
gcc/testsuite/gcc.dg/ubsan/pr103456.c, please move it there.
> @@ -0,0 +1,21 @@
> +/* PR tree-optimization/103456 */
> +/* { dg-do compile } */
> +/* { dg-options "-fsanitize=undefined -O -fdump-tree-objsz" } */
> +
> +static char *multilib_options = "m64/m32";
> +
> +void
> +used_arg_t (void)
> +{
> + char *q = multilib_options;
> + for (;;)
> + {
> + while (*q)
> + q++;
> + while (__builtin_strchr (q, '_') == 0)
> + while (*q)
> + q++;
> + }
> +}
> +
> +/* { dg-final { scan-tree-dump-not "maximum object size 0" "objsz1" } } */
> diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
> index 3780437ff91..b4881ef198f 100644
> --- a/gcc/tree-object-size.c
> +++ b/gcc/tree-object-size.c
> @@ -854,7 +854,8 @@ merge_object_sizes (struct object_size_info *osi, tree dest, tree orig,
> orig_bytes = (offset > orig_bytes)
> ? HOST_WIDE_INT_0U : orig_bytes - offset;
>
> - osi->changed = object_sizes_set (osi, varno, orig_bytes);
> + if (object_sizes_set (osi, varno, orig_bytes))
> + osi->changed = true;
>
> return bitmap_bit_p (osi->reexamine, SSA_NAME_VERSION (orig));
> }
Otherwise LGTM.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* [COMMITTED] tree-optimization/103456 - Record only successes from object_sizes_set
2021-12-01 7:18 ` Jakub Jelinek
@ 2021-12-01 8:31 ` Siddhesh Poyarekar
2021-12-03 11:13 ` [committed] testsuite: Fix up pr103456.c testcase [PR103456] Jakub Jelinek
0 siblings, 1 reply; 4+ messages in thread
From: Siddhesh Poyarekar @ 2021-12-01 8:31 UTC (permalink / raw)
To: gcc-patches; +Cc: jakub, Martin Liška
Avoid overwriting osi->changed if object_sizes_set does not update the
size, so that a previous success in the same pass is not overwritten.
This fixes the bootstrap-ubsan build config, which was failing due to
incorrect object size.
gcc/ChangeLog:
PR tree-optimization/103456
* tree-object-size.c (merge_object_sizes): Update osi->changed
only if object_sizes_set succeeded.
gcc/testsuite/ChangeLog:
PR tree-optimization/103456
* gcc.dg/ubsan/pr103456.c: New test.
Co-authored-by: Martin Liška <mliska@suse.cz>
Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org>
---
gcc/testsuite/gcc.dg/ubsan/pr103456.c | 21 +++++++++++++++++++++
gcc/tree-object-size.c | 3 ++-
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/ubsan/pr103456.c
diff --git a/gcc/testsuite/gcc.dg/ubsan/pr103456.c b/gcc/testsuite/gcc.dg/ubsan/pr103456.c
new file mode 100644
index 00000000000..20322fbaab1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ubsan/pr103456.c
@@ -0,0 +1,21 @@
+/* PR tree-optimization/103456 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=undefined -O -fdump-tree-objsz" } */
+
+static char *multilib_options = "m64/m32";
+
+void
+used_arg_t (void)
+{
+ char *q = multilib_options;
+ for (;;)
+ {
+ while (*q)
+ q++;
+ while (__builtin_strchr (q, '_') == 0)
+ while (*q)
+ q++;
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "maximum object size 0" "objsz1" } } */
diff --git a/gcc/tree-object-size.c b/gcc/tree-object-size.c
index 3780437ff91..b4881ef198f 100644
--- a/gcc/tree-object-size.c
+++ b/gcc/tree-object-size.c
@@ -854,7 +854,8 @@ merge_object_sizes (struct object_size_info *osi, tree dest, tree orig,
orig_bytes = (offset > orig_bytes)
? HOST_WIDE_INT_0U : orig_bytes - offset;
- osi->changed = object_sizes_set (osi, varno, orig_bytes);
+ if (object_sizes_set (osi, varno, orig_bytes))
+ osi->changed = true;
return bitmap_bit_p (osi->reexamine, SSA_NAME_VERSION (orig));
}
--
2.31.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [committed] testsuite: Fix up pr103456.c testcase [PR103456]
2021-12-01 8:31 ` [COMMITTED] " Siddhesh Poyarekar
@ 2021-12-03 11:13 ` Jakub Jelinek
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2021-12-03 11:13 UTC (permalink / raw)
To: Siddhesh Poyarekar; +Cc: gcc-patches, Martin Liška
On Wed, Dec 01, 2021 at 02:01:59PM +0530, Siddhesh Poyarekar wrote:
> PR tree-optimization/103456
> * gcc.dg/ubsan/pr103456.c: New test.
ubsan.exp cycles through torture options, and that includes
-O2 -flto -fno-fat-lto-objects. But with those options
tree dump scans don't work for post-IPA passes, for dg-do
compile tests nothing after IPA is done. So we get an
unresolved testcase:
gcc.dg/ubsan/pr103456.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects : dump file does not exist
UNRESOLVED: gcc.dg/ubsan/pr103456.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects scan-tree-dump-not objsz1 "maximum object size 0"
Fixed by adding -ffat-lto-objects so that we perform the post-IPA
passes.
Tested on x86_64-linux, committed to trunk as obvious.
2021-12-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/103456
* gcc.dg/ubsan/pr103456.c: Add -ffat-lto-objects to dg-options.
--- gcc/testsuite/gcc.dg/ubsan/pr103456.c.jj 2021-12-01 10:03:55.404029919 +0100
+++ gcc/testsuite/gcc.dg/ubsan/pr103456.c 2021-12-03 12:06:57.613750230 +0100
@@ -1,6 +1,6 @@
/* PR tree-optimization/103456 */
/* { dg-do compile } */
-/* { dg-options "-fsanitize=undefined -O -fdump-tree-objsz" } */
+/* { dg-options "-fsanitize=undefined -O -fdump-tree-objsz -ffat-lto-objects" } */
static char *multilib_options = "m64/m32";
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-03 11:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-01 4:17 [PATCH] tree-optimization/103456 - Record only successes from object_sizes_set Siddhesh Poyarekar
2021-12-01 7:18 ` Jakub Jelinek
2021-12-01 8:31 ` [COMMITTED] " Siddhesh Poyarekar
2021-12-03 11:13 ` [committed] testsuite: Fix up pr103456.c testcase [PR103456] Jakub Jelinek
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).