public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <srostedt@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	rostedt@goodmis.org, "David S. Miller" <davem@davemloft.net>,
	sparclinux <sparclinux@vger.kernel.org>
Subject: ftrace breaks sparc64 build
Date: Mon, 5 Jan 2009 19:19:22 +0100	[thread overview]
Message-ID: <20090105181922.GA25622@uranus.ravnborg.org> (raw)

With an allmodconfig build on sparc and sparc64 I started
to see warnings that become propagated to errors by -Werror.

Example:
  CC      arch/sparc/kernel/ldc.o
arch/sparc/kernel/ldc.c: In function `process_control_frame':
arch/sparc/kernel/ldc.c:627: warning: 'vap' might be used uninitialized in this function


The code in question looks like this:
static int process_ver_nack(struct ldc_channel *lp, struct ldc_version *vp)
{
        struct ldc_version *vap;

        if ((vp->major == 0 && vp->minor == 0) ||
            !(vap = find_by_major(vp->major))) {
                return ldc_abort(lp);
        } else {
                struct ldc_packet *p;
                unsigned long new_tail;

                p = handshake_compose_ctrl(lp, LDC_INFO, LDC_VERS,
                                           vap, sizeof(*vap),
                                           &new_tail);
                if (p)
                        return send_tx_packet(lp, p, new_tail);
                else
                        return ldc_abort(lp);
        }
}

The else part will never be executed whitout assigning vap,
and this code do not emit warnings in the normal case.
[I am well aware that we recommend to move the assignment
out of the if () - but this code worked as is before].

This code gets expanded to:

static int process_ver_nack(struct ldc_channel *lp, struct ldc_version *vp)
{
	struct ldc_version *vap;

	if (__builtin_constant_p(((vp->major == 0 && vp->minor == 0) || !(vap = find_by_major(vp->major)))) ? 
	!!((vp->major == 0 && vp->minor == 0) || !(vap = find_by_major(vp->major))) : 
	({
		int ______r;
		static struct ftrace_branch_data  ______f = { .func = __func__, .file = "arch/sparc/kernel/ldc.c", .line = 630, };
		______r = !!((vp->major == 0 && vp->minor == 0) || !(vap = find_by_major(vp->major)));
		if (______r)
			______f.hit++;
		else
			______f.miss++; ______r;
	})) {

		return ldc_abort(lp);
	} else {
		struct ldc_packet *p;
		unsigned long new_tail;

		p = handshake_compose_ctrl(lp, 0x01, 0x01, vap, sizeof(*vap), &new_tail);
		if (__builtin_constant_p((p)) ? !!(p) : ({
			int ______r;
			static struct ftrace_branch_data ______f = { .func = __func__, .file = "arch/sparc/kernel/ldc.c", .line = 639, };
			______r = !!(p);
			if (______r)
				______f.hit++;
			else ______f.miss++;
				______r;
		}))
	 		return send_tx_packet(lp, p, new_tail);
		else
			return ldc_abort(lp);
	}
}
I have inserted newlines + tabs and removed a few __attribute__()
to keep line lengths to a sensible level.

My head started to spin with a dangerous speed trying to figure out
the code snippet above.

On top of this some inlining occurs which is why gcc point at another
function name.


This is with following gcc version:

sparc64-unknown-linux-gnu-gcc (GCC) 3.4.5
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Build using crosstool.

Is this a known issue?

Any recommendations?

	Sam

             reply	other threads:[~2009-01-05 18:18 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-05 18:19 Sam Ravnborg [this message]
2009-01-05 19:31 ` ftrace breaks sparc64 build Steven Rostedt
2009-01-05 19:42   ` [PATCH] sparc: make proces_ver_nack a bit more readable Steven Rostedt
2009-01-05 19:46     ` Steven Rostedt
2009-01-05 19:56     ` Steven Rostedt
2009-01-05 20:07       ` Sam Ravnborg
2009-01-05 20:08     ` Sam Ravnborg
2009-01-06 18:23       ` David Miller
2009-01-05 19:54   ` ftrace breaks sparc64 build Sam Ravnborg
2009-01-05 20:05     ` Steven Rostedt
2009-01-05 21:31       ` Sam Ravnborg
2009-01-05 21:52         ` Steven Rostedt
2009-01-05 22:01           ` Sam Ravnborg
2009-01-05 22:14             ` Steven Rostedt
2009-01-05 23:11               ` Heiko Carstens
2009-01-06  2:07                 ` Steven Rostedt
2009-01-06  9:36                   ` Heiko Carstens
2009-01-06  4:30                 ` Steven Rostedt
2009-01-06  9:45                   ` Heiko Carstens
2009-01-06 18:32       ` David Miller
2009-01-06 18:52         ` Steven Rostedt
2009-01-06 19:01           ` David Miller
2009-01-06 19:52             ` Sam Ravnborg
2009-01-06 20:02               ` David Miller
2009-01-05 20:30     ` [PATCH] module: clean up initialization of variable Steven Rostedt
2009-01-05 22:59       ` Harvey Harrison
2009-01-06  1:22       ` Rusty Russell
2009-01-06  2:02         ` Steven Rostedt
2009-01-05 19:48 ` ftrace breaks sparc64 build Al Viro
2009-01-05 19:55   ` Sam Ravnborg
2009-01-06  7:53     ` Jan Beulich
2009-01-06 11:35       ` Al Viro
2009-01-06 12:39         ` Jan Beulich
2009-01-06 13:34         ` Sam Ravnborg
2009-01-06 15:52           ` Al Viro
2009-01-06 18:39           ` David Miller
2009-01-08  9:28         ` Jan Beulich

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=20090105181922.GA25622@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=srostedt@redhat.com \
    /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