From: Al Viro <viro@ZenIV.linux.org.uk>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
Thorsten Leemhuis <regressions@leemhuis.info>,
linuxppc-dev@lists.ozlabs.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: gcc 4.6.3 miscompile on ppc32 (was Re: Regression in kernel 4.12-rc1 for Powerpc 32 - bisected to commit 3448890c32c3)
Date: Sun, 25 Jun 2017 23:21:06 +0100 [thread overview]
Message-ID: <20170625222106.GX10672@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20170625214408.GT16550@gate.crashing.org>
On Sun, Jun 25, 2017 at 04:44:09PM -0500, Segher Boessenkool wrote:
> Do you have a short stand-alone testcase? 4.6 is ancient, of course, but
> the actual problem may still exist in more recent compilers (if it _is_
> a compiler problem; if it's not, you *really* want to know :-) )
Enjoy. At least 6.3 doesn't step into that. Look for mtctr in the resulting
asm...
cat <<'EOF' >a.c
struct iovec
{
void *iov_base;
unsigned iov_len;
};
unsigned long v;
extern void * barf(void *,int,unsigned);
extern unsigned long bar(void *to, const void *from, unsigned long size);
static inline unsigned long __bar(void *to, const void *from, unsigned long n)
{
unsigned long res = n;
if (__builtin_expect(!!(((void)0, (((( unsigned long)(from)) <= v) && ((((n)) == 0) || ((((n)) - 1) <= (v - (( unsigned long)(from)))))))), 1))
res = bar(to, from, n);
if (res)
barf(to + (n - res), 0, res);
return res;
}
int foo(int type, const struct iovec * uvector,
unsigned long nr_segs, unsigned long fast_segs,
struct iovec *iov,
struct iovec **ret_pointer)
{
unsigned long seg;
int ret;
if (nr_segs == 0) {
ret = 0;
goto out;
}
if (nr_segs > 1024) {
ret = -22;
goto out;
}
if (__bar(iov, uvector, nr_segs*sizeof(*uvector))) {
ret = -14;
goto out;
}
ret = 0;
for (seg = 0; seg < nr_segs; seg++) {
void *buf = iov[seg].iov_base;
int len = (int)iov[seg].iov_len;
if (len < 0) {
ret = -22;
goto out;
}
if (type >= 0
&& __builtin_expect(!!(!((void)0, (((( unsigned long)(buf)) <= v) && ((((len)) == 0) || ((((len)) - 1) <= (v - (( unsigned long)(buf)))))))), 0)) {
ret = -14;
goto out;
}
ret += len;
}
out:
*ret_pointer = iov;
return ret;
}
EOF
powerpc-linux-gcc -m32 -fno-strict-aliasing -fno-common -std=gnu89 -fno-PIE -msoft-float -pipe -ffixed-r2 -mmultiple -mno-altivec -mno-vsx -mno-spe -mspe=no -funit-at-a-time -fno-dwarf2-cfi-asm -mno-string -mcpu=powerpc -Wa,-maltivec -mbig-endian -fno-delete-null-pointer-checks -Os -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -fno-var-tracking-assignments -femit-struct-debug-baseonly -fno-var-tracking -fno-strict-overflow -fconserve-stack -fverbose-asm -S a.c
next prev parent reply other threads:[~2017-06-25 22:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <69187aa4-611f-b08a-8d14-b8fa47b4c464@lwfinger.net>
[not found] ` <1588557c-2706-0c0e-3387-4ae65d0b5790@lwfinger.net>
[not found] ` <20170621212257.GN10672@ZenIV.linux.org.uk>
[not found] ` <5f4b9fa4-262a-31b1-32ba-a2f6e789b3d6@lwfinger.net>
[not found] ` <20170621213415.GO10672@ZenIV.linux.org.uk>
[not found] ` <655d304e-e455-6e0c-56e1-f127653ea13c@lwfinger.net>
[not found] ` <20170622141203.GP10672@ZenIV.linux.org.uk>
[not found] ` <7bbd4c87-e8ff-5f83-8c4c-e205872083bf@lwfinger.net>
[not found] ` <20170622192515.GQ10672@ZenIV.linux.org.uk>
[not found] ` <2346c306-8e26-94cb-3c63-b866a7f4625d@lwfinger.net>
2017-06-23 20:29 ` Regression in kernel 4.12-rc1 for Powerpc 32 - bisected to commit 3448890c32c3 Al Viro
2017-06-24 0:04 ` Larry Finger
2017-06-24 17:29 ` Larry Finger
2017-06-25 9:53 ` Al Viro
2017-06-25 11:14 ` Al Viro
2017-06-25 20:53 ` gcc 4.6.3 miscompile on ppc32 (was Re: Regression in kernel 4.12-rc1 for Powerpc 32 - bisected to commit 3448890c32c3) Al Viro
2017-06-25 21:44 ` Segher Boessenkool
2017-06-25 22:21 ` Al Viro [this message]
2017-06-26 13:37 ` Michael Ellerman
2017-06-26 13:40 ` Regression in kernel 4.12-rc1 for Powerpc 32 - bisected to commit 3448890c32c3 Michael Ellerman
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=20170625222106.GX10672@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=Larry.Finger@lwfinger.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=regressions@leemhuis.info \
--cc=segher@kernel.crashing.org \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).