public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "joolzg at btinternet dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/49620] New: piece of code from modification to dvblast but cant get it to compile and run correctly
Date: Sun, 03 Jul 2011 19:43:00 -0000	[thread overview]
Message-ID: <bug-49620-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49620

           Summary: piece of code from modification to dvblast but cant
                    get it to compile and run correctly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joolzg@btinternet.com


Created attachment 24664
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24664
bug report

I have a function that only works when i add another function call inbetween.

block_t *file_Read( mtime_t i_poll_timeout )
{
    i_wallclock = mdate();

    {
        block_t *p_ts, **pp_current = &p_ts;
        int i, i_len;

        if ( !i_last_packet )
        {
            switch (i_print_type) {
            case PRINT_XML:
                printf("<STATUS type=\"lock\" status=\"1\"/>\n");
                break;
            default:
                printf("frontend has acquired lock\n" );
            }
        }
        i_last_packet = i_wallclock;

        i_len = 0;
        for ( i = 0; i < i_bufsize / TS_SIZE; i++ )
        {
            *pp_current = block_New();
            i_len2 = fread( (*pp_current)->p_ts, 1, TS_SIZE, file_input);
//            msg_Warn( NULL, "read from file %s (%s) %d %p",
//                       filename, strerror(errno), i_len2, pp_current );
            if ( i_len2 < 188 )
            {
            if ( i_len2 < 188 )
            {
                msg_Err( NULL, "couldn't read from file %s (%s) %d %p",
                         filename, strerror(errno), i_len2, pp_current );
                i_len = 0;
                break;
            }
            i_len++;
            pp_current = &(*pp_current)->p_next;
        }

        pp_current = &p_ts;
        while ( i_len && *pp_current )
        {
            pp_current = &(*pp_current)->p_next;
            i_len--;
        }

        if ( *pp_current )
            msg_Dbg( NULL, "partial buffer received" );

        block_DeleteChain( *pp_current );
        *pp_current = NULL;

        return p_ts;
    }

    return NULL;
}

Now the code above DOES not work in 
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
or
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)

Both machines are Ubuntu 64bit.

If the commented out msg_Warn is uncommented then the code works and we get no
error message

Ive also run it through clang and came up with no errors

joolz


             reply	other threads:[~2011-07-03 19:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-03 19:43 joolzg at btinternet dot com [this message]
2011-07-03 20:39 ` [Bug c/49620] " mikpe at it dot uu.se
2011-07-03 21:06 ` joolzg at btinternet dot com
2011-07-03 21:38 ` mikpe at it dot uu.se
2011-07-03 21:51 ` joolzg at btinternet dot com
2011-07-04  9:42 ` rguenth at gcc dot gnu.org
2011-07-04 10:00 ` redi at gcc dot gnu.org
2011-07-07  7:10 ` joolzg at btinternet dot com

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=bug-49620-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).