mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] FYI: gtk-3.24.30 and gcc 11.
Date: Wed, 1 Dec 2021 15:37:08 +0100	[thread overview]
Message-ID: <6dc7d656-18cf-3bdc-9e15-bc96ff416663@t2data.com> (raw)

Hi.

If anyone bumps into gtk-3.24.30 with gcc 11 compile issues before an 
update fixes it.. Might be useful to someone.

 From b4e110920aa18e6cc149ccbbfcd90b5143526e6d Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Mon, 11 Jan 2021 22:04:52 +0000
Subject: [PATCH] Merge branch 'wip/kalev/gcc-11' into 'master'

Avoid diagnostics for gcc-11 false positive out of bounds accesses

See merge request GNOME/gtk!3064

(cherry picked from commit 5044031b53988627c2937c6b5f8919a37e18f21f)

c514c41d Avoid diagnostics for gcc-11 false positive out of bounds accesses
---
  gtk/gtktextchild.c   | 14 ++++++++++++++
  gtk/gtktextsegment.c |  7 +++++++
  2 files changed, 21 insertions(+)

diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c
index 2ff7de2394..cbbcf91d66 100644
--- a/gtk/gtktextchild.c
+++ b/gtk/gtktextchild.c
@@ -129,6 +129,12 @@ const GtkTextLineSegmentClass gtk_text_pixbuf_type = {
  GtkTextLineSegment *
  _gtk_pixbuf_segment_new (GdkPixbuf *pixbuf)
  {
+  /* gcc-11 issues a diagnostic here because the size allocated
+     for SEG does not cover the entire size of a GtkTextLineSegment
+     and gcc has no way to know that the union will only be used
+     for limited types and the additional space is not needed.  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
    GtkTextLineSegment *seg;

    seg = g_slice_alloc (PIXBUF_SEG_SIZE);
@@ -148,6 +154,7 @@ _gtk_pixbuf_segment_new (GdkPixbuf *pixbuf)
    g_object_ref (pixbuf);

    return seg;
+#pragma GCC diagnostic pop
  }


@@ -224,6 +231,12 @@ const GtkTextLineSegmentClass gtk_text_child_type = {
  GtkTextLineSegment *
  _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
  {
+  /* gcc-11 issues a diagnostic here because the size allocated
+     for SEG does not cover the entire size of a GtkTextLineSegment
+     and gcc has no way to know that the union will only be used
+     for limited types and the additional space is not needed.  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
    GtkTextLineSegment *seg;

    seg = g_slice_alloc (WIDGET_SEG_SIZE);
@@ -247,6 +260,7 @@ _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
    g_object_ref (anchor);

    return seg;
+#pragma GCC diagnostic pop
  }

  void
diff --git a/gtk/gtktextsegment.c b/gtk/gtktextsegment.c
index 8539db5297..8e00b1ddc9 100644
--- a/gtk/gtktextsegment.c
+++ b/gtk/gtktextsegment.c
@@ -426,6 +426,12 @@ char_segment_check_func (GtkTextLineSegment 
*segPtr, GtkTextLine *line)
  GtkTextLineSegment*
  _gtk_toggle_segment_new (GtkTextTagInfo *info, gboolean on)
  {
+  /* gcc-11 issues a diagnostic here because the size allocated
+     for SEG does not cover the entire size of a GtkTextLineSegment
+     and gcc has no way to know that the union will only be used
+     for limited types and the additional space is not needed.  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
    GtkTextLineSegment *seg;

    seg = g_slice_alloc (TSEG_SIZE);
@@ -441,6 +447,7 @@ _gtk_toggle_segment_new (GtkTextTagInfo *info, 
gboolean on)
    seg->body.toggle.inNodeCounts = 0;

    return seg;
+#pragma GCC diagnostic pop
  }

  void
-- 
GitLab



_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


                 reply	other threads:[~2021-12-01 14:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dc7d656-18cf-3bdc-9e15-bc96ff416663@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox