From: Michal Marek <mmarek@suse.cz>
To: Martin Walch <walch.martin@web.de>, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v3] Kconfig: Remove bad inference rules expr_eliminate_dups2()
Date: Mon, 18 May 2015 15:36:03 +0800 [thread overview]
Message-ID: <55599663.6080203@suse.cz> (raw)
In-Reply-To: <6333557.fobqH0bixi@tacticalops>
Dne 17.5.2015 v 10:14 Martin Walch napsal(a):
> From: Martin Walch <walch.martin@web.de>
>
> expr_eliminate_dups2() in scripts/kconfig/expr.c applies two invalid
> inference rules:
>
> (FOO || BAR) && (!FOO && !BAR) -> n
> (FOO && BAR) || (!FOO || !BAR) -> y
>
> They would be correct in propositional logic, but this is a three-valued
> logic, and here it is wrong in that it changes semantics. It becomes
> immediately visible when assigning the value 1 to both, FOO and BAR:
>
> (FOO || BAR) && (!FOO && !BAR)
> -> min(max(1, 1), min(2-1, 2-1)) = min(1, 1) = 1
>
> while n evaluates to 0 and
>
> (FOO && BAR) || (!FOO || !BAR)
> -> max(min(1, 1), max(2-1, 2-1)) = max(1, 1) = 1
>
> with y evaluating to 2.
Are you able to construct a testcase that triggers this bug? I haven't
been successful:
$ cat Kconfig.test
config MODULES
def_bool y
option modules
config FOO
def_tristate m
config BAR
def_tristate m
config TEST1
def_tristate (FOO || BAR) && (!FOO && !BAR)
if TEST1 != m
comment "TEST1 broken"
endif
config TEST2
def_tristate (FOO && BAR) || (!FOO || !BAR)
if TEST2 != m
comment "TEST2 broken"
endif
$ ./scripts/kconfig/conf Kconfig.test && cat .config
*
* Linux Kernel Configuration
*
#
# configuration written to .config
#
#
# Automatically generated file; DO NOT EDIT.
# Linux Kernel Configuration
#
CONFIG_MODULES=y
CONFIG_FOO=m
CONFIG_BAR=m
CONFIG_TEST1=m
CONFIG_TEST2=m
I'm all for eliminating unneeded code, but if it's meant to fix a bug as
well, I'd like to understand the bug.
thanks,
Michal
next prev parent reply other threads:[~2015-05-18 7:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-17 2:14 [PATCH v3] Kconfig: Remove bad inference rules expr_eliminate_dups2() Martin Walch
2015-05-18 7:36 ` Michal Marek [this message]
2015-05-18 9:38 ` Martin Walch
2015-05-21 6:39 ` Michal Marek
2015-05-22 11:41 ` [PATCH v4] " Martin Walch
2015-05-25 8:05 ` Michal Marek
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=55599663.6080203@suse.cz \
--to=mmarek@suse.cz \
--cc=linux-kbuild@vger.kernel.org \
--cc=walch.martin@web.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 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.