* [PATCH 1/1] puzzles: fix uninitialized variable compiler error
@ 2019-03-14 19:19 Joe Slater
2019-03-14 19:25 ` Burton, Ross
2019-03-15 5:41 ` Khem Raj
0 siblings, 2 replies; 6+ messages in thread
From: Joe Slater @ 2019-03-14 19:19 UTC (permalink / raw)
To: openembedded-core
In tree234.c, change a while() loop to a for() loop so
that the compiler will realize we loop at least once.
Signed-off-by: Joe Slater <joe.slater@windriver.com>
---
.../puzzles/files/fix-ki-uninitialized.patch | 25 ++++++++++++++++++++++
meta/recipes-sato/puzzles/puzzles_git.bb | 1 +
2 files changed, 26 insertions(+)
create mode 100644 meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
diff --git a/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
new file mode 100644
index 0000000..7218d62
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
@@ -0,0 +1,25 @@
+puzzles: avoid compiler unitialized variable error
+
+The compiler does not realize that we must go through the while()
+loop at least once, so we replace it with a for() loop.
+
+Upstream-Status: Pending
+
+Signed-off-by: Joe Slater <joe.slater@windriver.com>
+
+--- a/tree234.c
++++ b/tree234.c
+@@ -326,8 +326,11 @@ static void *add234_internal(tree234 *t,
+ return orig_e;
+ }
+
+- n = t->root;
+- while (n) {
++ /*
++ * We know t->root is not NULL. The logic
++ * to break out of this is at the end of the loop.
++ */
++ for (n = t->root;;) {
+ LOG((" node %p: %p/%d \"%s\" %p/%d \"%s\" %p/%d \"%s\" %p/%d\n",
+ n,
+ n->kids[0], n->counts[0], n->elems[0],
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index 0766bd4..59b9525 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -14,6 +14,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \
file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \
file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \
+ file://fix-ki-uninitialized.patch \
"
UPSTREAM_CHECK_COMMITS = "1"
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] puzzles: fix uninitialized variable compiler error
2019-03-14 19:19 [PATCH 1/1] puzzles: fix uninitialized variable compiler error Joe Slater
@ 2019-03-14 19:25 ` Burton, Ross
2019-03-15 10:43 ` Adrian Bunk
2019-03-15 5:41 ` Khem Raj
1 sibling, 1 reply; 6+ messages in thread
From: Burton, Ross @ 2019-03-14 19:25 UTC (permalink / raw)
To: Joe Slater; +Cc: OE-core
Can we *please* start sending these upstream. It's not like the
maintainer isn't responsive.
Ross
On Thu, 14 Mar 2019 at 19:20, Joe Slater <joe.slater@windriver.com> wrote:
>
> In tree234.c, change a while() loop to a for() loop so
> that the compiler will realize we loop at least once.
>
> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> ---
> .../puzzles/files/fix-ki-uninitialized.patch | 25 ++++++++++++++++++++++
> meta/recipes-sato/puzzles/puzzles_git.bb | 1 +
> 2 files changed, 26 insertions(+)
> create mode 100644 meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
>
> diff --git a/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
> new file mode 100644
> index 0000000..7218d62
> --- /dev/null
> +++ b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
> @@ -0,0 +1,25 @@
> +puzzles: avoid compiler unitialized variable error
> +
> +The compiler does not realize that we must go through the while()
> +loop at least once, so we replace it with a for() loop.
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Joe Slater <joe.slater@windriver.com>
> +
> +--- a/tree234.c
> ++++ b/tree234.c
> +@@ -326,8 +326,11 @@ static void *add234_internal(tree234 *t,
> + return orig_e;
> + }
> +
> +- n = t->root;
> +- while (n) {
> ++ /*
> ++ * We know t->root is not NULL. The logic
> ++ * to break out of this is at the end of the loop.
> ++ */
> ++ for (n = t->root;;) {
> + LOG((" node %p: %p/%d \"%s\" %p/%d \"%s\" %p/%d \"%s\" %p/%d\n",
> + n,
> + n->kids[0], n->counts[0], n->elems[0],
> diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
> index 0766bd4..59b9525 100644
> --- a/meta/recipes-sato/puzzles/puzzles_git.bb
> +++ b/meta/recipes-sato/puzzles/puzzles_git.bb
> @@ -14,6 +14,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
> file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \
> file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \
> file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \
> + file://fix-ki-uninitialized.patch \
> "
>
> UPSTREAM_CHECK_COMMITS = "1"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] puzzles: fix uninitialized variable compiler error
2019-03-14 19:19 [PATCH 1/1] puzzles: fix uninitialized variable compiler error Joe Slater
2019-03-14 19:25 ` Burton, Ross
@ 2019-03-15 5:41 ` Khem Raj
1 sibling, 0 replies; 6+ messages in thread
From: Khem Raj @ 2019-03-15 5:41 UTC (permalink / raw)
To: Joe Slater; +Cc: Patches and discussions about the oe-core layer
On Thu, Mar 14, 2019 at 12:20 PM Joe Slater <joe.slater@windriver.com> wrote:
>
> In tree234.c, change a while() loop to a for() loop so
> that the compiler will realize we loop at least once.
>
> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> ---
> .../puzzles/files/fix-ki-uninitialized.patch | 25 ++++++++++++++++++++++
> meta/recipes-sato/puzzles/puzzles_git.bb | 1 +
> 2 files changed, 26 insertions(+)
> create mode 100644 meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
>
> diff --git a/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
> new file mode 100644
> index 0000000..7218d62
> --- /dev/null
> +++ b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch
> @@ -0,0 +1,25 @@
> +puzzles: avoid compiler unitialized variable error
> +
> +The compiler does not realize that we must go through the while()
> +loop at least once, so we replace it with a for() loop.
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Joe Slater <joe.slater@windriver.com>
> +
> +--- a/tree234.c
> ++++ b/tree234.c
> +@@ -326,8 +326,11 @@ static void *add234_internal(tree234 *t,
> + return orig_e;
> + }
> +
> +- n = t->root;
> +- while (n) {
> ++ /*
> ++ * We know t->root is not NULL. The logic
> ++ * to break out of this is at the end of the loop.
> ++ */
> ++ for (n = t->root;;) {
may do .. while () is better
> + LOG((" node %p: %p/%d \"%s\" %p/%d \"%s\" %p/%d \"%s\" %p/%d\n",
> + n,
> + n->kids[0], n->counts[0], n->elems[0],
> diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
> index 0766bd4..59b9525 100644
> --- a/meta/recipes-sato/puzzles/puzzles_git.bb
> +++ b/meta/recipes-sato/puzzles/puzzles_git.bb
> @@ -14,6 +14,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
> file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \
> file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \
> file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \
> + file://fix-ki-uninitialized.patch \
> "
>
> UPSTREAM_CHECK_COMMITS = "1"
> --
> 2.7.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] puzzles: fix uninitialized variable compiler error
2019-03-14 19:25 ` Burton, Ross
@ 2019-03-15 10:43 ` Adrian Bunk
2019-03-15 11:50 ` Adrian Bunk
0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2019-03-15 10:43 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
On Thu, Mar 14, 2019 at 07:25:16PM +0000, Burton, Ross wrote:
> Can we *please* start sending these upstream. It's not like the
> maintainer isn't responsive.
This would also help to get such patches properly reviewed.
> Ross
>
> On Thu, 14 Mar 2019 at 19:20, Joe Slater <joe.slater@windriver.com> wrote:
>...
> > +The compiler does not realize that we must go through the while()
> > +loop at least once, so we replace it with a for() loop.
>...
> > +- n = t->root;
> > +- while (n) {
> > ++ /*
> > ++ * We know t->root is not NULL. The logic
> > ++ * to break out of this is at the end of the loop.
> > ++ */
> > ++ for (n = t->root;;) {
>...
This is the second patch this week where I don't see why a "fix" should
make any difference.
The code immediately above is:
if (t->root == NULL) {
...
return orig_e;
)
The submitter did not provide information how to reproduce,
but when I try to reproduce the problem on amd64 it happens
only with -Og (due to puzzles upstream building with -Werror).
This would also explain why such patches suddenly start getting
submitted - 2 weeks ago DEBUG_OPTIMIZATION was changed from -O to -Og.
-Werror is added after the passed CFLAGS so adding -Wno-error globally
would not help here, but a non-upstreamable patch to remove the -Werror
looks more correct here as a short-term workaround.
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] puzzles: fix uninitialized variable compiler error
2019-03-15 10:43 ` Adrian Bunk
@ 2019-03-15 11:50 ` Adrian Bunk
2019-03-15 12:03 ` Burton, Ross
0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2019-03-15 11:50 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
On Fri, Mar 15, 2019 at 12:43:06PM +0200, Adrian Bunk wrote:
>...
> but when I try to reproduce the problem on amd64 it happens
> only with -Og (due to puzzles upstream building with -Werror).
>...
For the root cause I filed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89723
cu
Adrian
--
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] puzzles: fix uninitialized variable compiler error
2019-03-15 11:50 ` Adrian Bunk
@ 2019-03-15 12:03 ` Burton, Ross
0 siblings, 0 replies; 6+ messages in thread
From: Burton, Ross @ 2019-03-15 12:03 UTC (permalink / raw)
To: Adrian Bunk; +Cc: OE-core
On Fri, 15 Mar 2019 at 11:50, Adrian Bunk <bunk@stusta.de> wrote:
> For the root cause I filed
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89723
Cookie for Mr Bunk! Thanks.
Ross
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-03-15 12:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 19:19 [PATCH 1/1] puzzles: fix uninitialized variable compiler error Joe Slater
2019-03-14 19:25 ` Burton, Ross
2019-03-15 10:43 ` Adrian Bunk
2019-03-15 11:50 ` Adrian Bunk
2019-03-15 12:03 ` Burton, Ross
2019-03-15 5:41 ` Khem Raj
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.