cc1plus bails can't handle situation

Bug #827806 reported by jas mann on 2011-08-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc
Fix Released
Medium
gcc-4.5 (Ubuntu)
Medium
Unassigned
gcc-4.6 (Ubuntu)
Medium
Unassigned

Bug Description

src/bp/bp_b.cc: In lambda function:
src/bp/bp_b.cc:538:33: error: invalid conversion from ‘tt_bookprxor::open_newfeeds()::x2feed*’ to ‘int’
src/bp/bp_b.cc:539:25: error: base operand of ‘->’ is not a pointer
src/bp/bp_b.cc:540:24: error: ‘x2feeds_i’ was not declared in this scope
src/bp/bp_b.cc:540:58: error: return-statement with a value, in function returning 'void'
src/bp/bp_b.cc:545:9: warning: name lookup of ‘x2feed_i’ changed
src/bp/bp_b.cc:534:46: warning: matches this ‘x2feed_i’ under ISO standard rules
src/bp/bp_b.cc:538:22: warning: matches this ‘x2feed_i’ under old rules
src/bp/bp_b.cc:545:55: error: cannot convert ‘tt::feedhdlr*’ to ‘circlist<tt::feedhdlr*>*’ in assignment
src/bp/bp_b.cc:546: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccR2q49G.out file, please attach this to your bugreport.

ProblemType: Crash
DistroRelease: Ubuntu 11.04
Package: g++-4.5 4.5.2-8ubuntu4
ProcVersionSignature: Ubuntu 2.6.38-10.46-generic 2.6.38.7
Uname: Linux 2.6.38-10-generic x86_64
NonfreeKernelModules: nvidia
Architecture: amd64
Date: Tue Aug 16 23:24:26 2011
ExecutablePath: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007)
SourcePackage: gcc-4.5
UpgradeStatus: Upgraded to natty on 2011-05-29 (79 days ago)

jas mann (dotmarker) wrote :
In , Doko-v (doko-v) wrote :

Created attachment 25045
preprocessed source

fails with current 4.5 and 4.6 branches, and trunk.

$ g++ -std=c++0x -c bp_b.ii
src/bp/bp_b.cc: In lambda function:
src/bp/bp_b.cc:538:33: error: invalid conversion from 'tt_bookprxor::open_newfeeds()::x2feed*' to 'int' [-fpermissive]
src/bp/bp_b.cc:539:25: error: base operand of '->' is not a pointer
src/bp/bp_b.cc:540:24: error: 'x2feeds_i' was not declared in this scope
src/bp/bp_b.cc:540:58: error: return-statement with a value, in function returning 'void' [-fpermissive]
src/bp/bp_b.cc:545:9: warning: name lookup of 'x2feed_i' changed [enabled by default]
src/bp/bp_b.cc:534:46: warning: matches this 'x2feed_i' under ISO standard rules [enabled by default]
src/bp/bp_b.cc:538:22: warning: matches this 'x2feed_i' under old rules [enabled by default]
src/bp/bp_b.cc:545:55: error: cannot convert 'tt::feedhdlr*' to 'circlist<tt::feedhdlr*>*' in assignment
src/bp/bp_b.cc:547:5: internal compiler error: in pop_binding, at cp/name-lookup.c:382
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions.

Matthias Klose (doko) on 2011-08-18
Changed in gcc-4.5 (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Changed in gcc-4.6 (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Changed in gcc:
importance: Unknown → Medium
status: Unknown → New

You know what I'm going to ask... ;)

Download full text (3.3 KiB)

Sorry, I don't know, but I can venture some guesses:
Q. Why did I code in such a manner as to foil parsing of the source?
A. Careless, or worse? The error was obvious of course so in that respect a crash was as good as a diagnostic.
Q. You want the preprocessor output?
A. It's gone. I thought perhaps the bug reporting script grabbed it.
Q. Why didn't I attach the preprocessor output to the bug report?
A. I guess it wasn't immediately obvious how, and I was in a rush.
Q: What was the code that caused the problem?
A. I don't remember. I corrected it at the time. I should have saved it and should a similar situation arise in the future I will do so.

Here's the lambda in which the indicated errors used to be if that's any help. It iterates through a circular list of circular lists.

auto log_serviceorder = [&]() {
    const char* F = "%2d. %c[%d] %s id=%d\n";
    $LOG(log, BP, TTINF, "service order for %d feeds follows:\n", feedcount);
    for(int i=0; i < feedcount; i++) {
        circlist<tt::feedhdlr*>::node* feednode = feedgroups.next()->content.next();
        tt::feedhdlr* feed = feednode->content;
        $LOG(log,BP,TTINF,F, i, feed->venue(),feednode->id,feed->name(),feed->id());
    }
} ;

> Date: Fri, 19 Aug 2011 09:18:00 +0000
> From: <email address hidden>
> To: <email address hidden>
> Subject: [Bug 827806]
>
> You know what I'm going to ask... ;)
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/827806
>
> Title:
> cc1plus bails can't handle situation
>
> Status in The GNU Compiler Collection:
> New
> Status in “gcc-4.5” package in Ubuntu:
> Confirmed
> Status in “gcc-4.6” package in Ubuntu:
> Confirmed
>
> Bug description:
> src/bp/bp_b.cc: In lambda function:
> src/bp/bp_b.cc:538:33: error: invalid conversion from ‘tt_bookprxor::open_newfeeds()::x2feed*’ to ‘int’
> src/bp/bp_b.cc:539:25: error: base operand of ‘->’ is not a pointer
> src/bp/bp_b.cc:540:24: error: ‘x2feeds_i’ was not declared in this scope
> src/bp/bp_b.cc:540:58: error: return-statement with a value, in function returning 'void'
> src/bp/bp_b.cc:545:9: warning: name lookup of ‘x2feed_i’ changed
> src/bp/bp_b.cc:534:46: warning: matches this ‘x2feed_i’ under ISO standard rules
> src/bp/bp_b.cc:538:22: warning: matches this ‘x2feed_i’ under old rules
> src/bp/bp_b.cc:545:55: error: cannot convert ‘tt::feedhdlr*’ to ‘circlist<tt::feedhdlr*>*’ in assignment
> src/bp/bp_b.cc:546: confused by earlier errors, bailing out
> Preprocessed source stored into /tmp/ccR2q49G.out file, please attach this to your bugreport.
>
> ProblemType: Crash
> DistroRelease: Ubuntu 11.04
> Package: g++-4.5 4.5.2-8ubuntu4
> ProcVersionSignature: Ubuntu 2.6.38-10.46-generic 2.6.38.7
> Uname: Linux 2.6.38-10-generic x86_64
> NonfreeKernelModules: nvidia
> Architecture: amd64
> Date: Tue Aug 16 23:24:26 2011
> ExecutablePath: /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/cc1plus
> InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007)
> SourcePackage: gcc-4.5
> UpgradeStatus: Upgraded to natty on 2011-05-29 (79 days...

Read more...

I was winking at Matthias... As he knows well, a reduced testcase (say, below 100 lines) would help a lot, if/when you can.

In , Pinskia (pinskia) wrote :

Reducing.

In , Pinskia (pinskia) wrote :

Here is one which is an ICE on valid code:
int open()
{
  int *x2feed_i = 0;
  auto insert_feed = [&](unsigned char venue, int* newfeed)
  {
     for(int x2feed_i = 1; 0; ) ;
     x2feed_i = newfeed;
  }
}

The only reason why the original was invalid was the invalid use of x2feed_i inside the loop as I think the int should have been auto.

Changed in gcc:
status: New → Confirmed

Author: jason
Date: Tue Aug 30 21:27:18 2011
New Revision: 178338

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178338
Log:
 PR c++/50114
 * decl.c (poplevel): Disable for scope compatibility hack
 in C++11 mode.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-for.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/forscope2.C

Fixed for 4.7.

Changed in gcc:
status: Confirmed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gcc-4.6 - 4.6.2-6ubuntu1

---------------
gcc-4.6 (4.6.2-6ubuntu1) precise; urgency=low

  * Merge with Debian.
  * Linaro GCC 4.6 2011-12 changes not yet in Ubuntu:
    - Generic tuning support for Big-endian platforms.
    - SLP support for operations with arbitrary numbers of operands.
    - SLP support for conditions.
    - Pattern recognition support in basic-block SLP.
    - Enhancements to mixed-size condition pattern recognition.
    - Unaligned block-move support for ARMv7.
    - Added Cortex-A15 integer pipeline tuning.

gcc-4.6 (4.6.2-6) unstable; urgency=low

  * Update to SVN 20111208 (r182120) from the gcc-4_6-branch.
    - Fix PR c++/51265, PR bootstrap/50888, PR target/51393 (ix86),
      PR target/51002 (AVR), PR target/51345 (AVR), PR debug/48190,
      PR fortran/50684, PR fortran/51218, PR target/50906 (closes: #650318),
      PR tree-optimization/51315 (closes: #635126), PR tree-optimization/50622,
      PR fortran/51435, PR debug/51410, PR c/51339, PR rtl-optimization/48721,
      PR middle-end/51323 (LP: #897583), PR middle-end/50074,
      PR middle-end/50074.

  [ Matthias Klose ]
  * Run the libstdc++ testsuite on all architectures again. Closes: #622699.
  * Apply proposed patch for PR target/50906 (powerpcspe only). Closes: #650318.
  * Fix PR target/49030 (ARM), taken from Linaro. Closes: #633479.
  * Fix PR target/50193 (ARM), taken from Linaro. Closes: #642127.
  * Install the libstdc++.so-gdb.py file. LP: #883269.
  * Fix PR c++/50114, backport from trunk. LP: #827806.
  * Merge changes to allow gcc-snapshot cross builds, taken from Linaro.
  * Update the Linaro support to the 4.6 branch.

  [ Marcin Juszkiewicz ]
  * Fix issues with gcc-snapshot cross builds.
  * Allow building Linaro binary packages in a single package.
  * Apply hardening patches for cross builds when enabled for native builds.
 -- Matthias Klose <email address hidden> Thu, 08 Dec 2011 17:17:30 +0100

Changed in gcc-4.6 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.