C++: How does pthread_cancel() work?

2010-02-02 Thread Christian Fröbel
Hi all,

I'm having a hard time figuring out how exactly pthread_cancel() works
in a C++ program. It seems that a thread cancellation is somewhat
similar to throwing an exception. But I couldn't find any proof or
details about it. I'm not even sure this topic is gcc-relevant but
hope someone can lighten up this issue.

I first came across this issue when I found a thread's main function
which enclosed most of it's parts in a try-catch(...)-block -- without
re-throwing anything. When that thread was subject to cancellation,
the program crashed in the catch(...)-block (I think).

So how exactly does pthread_cancel() work in C++?
Is it similar to exception handling -- so will destructors be called?
What exactly caused the crash described above?

Kind regards,
  Christian


Re: C++: How does pthread_cancel() work?

2010-02-02 Thread Jonathan Wakely
On 2 February 2010 08:26, Christian Fröbel wrote:
> Hi all,
>
> I'm having a hard time figuring out how exactly pthread_cancel() works
> in a C++ program. It seems that a thread cancellation is somewhat
> similar to throwing an exception. But I couldn't find any proof or
> details about it. I'm not even sure this topic is gcc-relevant but
> hope someone can lighten up this issue.

It's not about development of GCC so it's off-topic.


Re: [trans-mem] ipa tm pass and dominator walks

2010-02-02 Thread Richard Henderson

On 01/29/2010 08:56 AM, Aldy Hernandez wrote:

Hey!

With my last patch, we only have 3 instances of dominator tree walks
left in the tree, all in the TM ipa pass.

I believe we can leave those as they are, since the TM ipa pass runs
early enough that nothing has altered control flow such that
code outside of a transaction ends up inside a transaction.


I don't think that's true at all.  You showed that the walking was 
incorrect; I don't see you you can now argue that it is correct, 
regardless of inlining and jump threading.


All one needs to create the cfg that exhibits the problem is multiple 
exits from the transaction.  It's not terribly hard to create such a cfg 
directly in the source...



r~


Modulo Scheduling

2010-02-02 Thread Cameron Lowell Palmer
Does Modulo Scheduling work on x86 platforms? I have tried adding in
various versions of the -fmodulo-sched option and get the exact same
output with or without. The application is a very simplistic matrix
multiply without dependencies.

Thank you,

Cameron Palmer


Problems with `Installing GCC'

2010-02-02 Thread Rainer Orth
While preparing a revision of the sections in `Installing GCC' relevant
to my platforms, I've just read it front-to-back and found a couple of
problems I'd like to discuss before starting to develop patches.

* As a general note, many sections describe mechanism (which configure
  options are available, often without sufficiently describing what they
  do in terms someone not developing compilers can understand), but
  completely lack guidance about their use, i.e. when to use them and
  with which consequences.  My favorite examples here were
  --enable-threads=solaris, which led some users to configure this way,
  not recognizing that the default (posix) was a much better choice, and
  --enable-shared (no description what the consequences of disabling
  libgcc_s.so.1 are).

* The list of configure options lacks a recognizable structure, which
  makes it difficult even for a developer to find out where best to
  describe a new one.  (The worst offender I've found is the desciption
  of --with-libelf and --enable-gold in the list of general libjava
  options.)  I don't yet have a proposal how to fix this, but will
  investigate.  There are very different levels of detail, going as low
  as setting defaults for specific switches for a particular CPU
  (--with-llsc).  Add in the problem from the last point (no guidance),
  and the installation guide becomes hard to impossible to use for mere
  mortals.

  I can't help but get the impression that there are far too many
  configure options to be useful.

* The guide is far from complete: e.g., the libstdc++ configure options
  are missing completely (they are documented in the XML/HTML manual,
  but there's not even a pointer to that in the installation guide).  I
  fear other libraries have similar problems: I've already printed the
  output of configure --help for all in-tree configure scripts and plan
  to check them against the installation guide.  On the other hand,
  options described in the installation guide are missing from configure
  --help (again, --with-llsc is an example).

* There are tons of markup problems, some of which may be more visible
  in the printed version (which I've used for the review).
  Specificially, 

** it is completely missing in many places,

** it is highly inconsistent, like commands write with and without
   quotes, same for target triplets.

  I know much of this issue is nitpicking, but such attention to detail
  makes for the difference between a quick hack and a polished product.

* It's unclear if we want to keep anything from `Old installation
  documentation'.  This should be decided once and for all and then
  either incorporated into the guide proper or dropped completely.

I don't want this to be merely a rant, so I plan next to revise the
specific instructions for my targets and then try and come up with a
suggestion for a clearer structure for the configuration chapter, though
I fear that much of this will be 4.6 material.  After asking for more
guidance on the markup problems, I'll probably come up with a series of
patches making the guide consistent in a particular regard.

Comments?

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


Re: Problems with `Installing GCC'

2010-02-02 Thread Ian Lance Taylor
Rainer Orth  writes:

> I don't want this to be merely a rant, so I plan next to revise the
> specific instructions for my targets and then try and come up with a
> suggestion for a clearer structure for the configuration chapter, though
> I fear that much of this will be 4.6 material.  After asking for more
> guidance on the markup problems, I'll probably come up with a series of
> patches making the guide consistent in a particular regard.
>
> Comments?

Sounds great.  Please do it.

Ian


Re: Long paths with ../../../../ throughout

2010-02-02 Thread Jon

Hi Ian, Thank you for your reply.

Ian Lance Taylor wrote:

Jon Grant  writes:


I see that some of the files are located in the -L library directory
specified, crtbegin.o, crtend.o in which case, perhaps they both do
not need their full long path specified.


Most linkers do not use the -L path to search for file names on the
command line.


OK.


Also I notice lots of duplicate parameters:

Is this directory really needed twice?
-L/usr/lib/gcc/i486-linux-gnu/4.3.3 -L/usr/lib/gcc/i486-linux-gnu/4.3.3

No.  I would encourage you to investigate why it is happening.

i tried: gcc -o t -Wl,-debug test.c, I see collect2 gets the
duplicates passed to it, and then it passes it on to ld. I would have
thought that if collect2 was compiled with define
LINK_ELIMINATE_DUPLICATE_LDIRECTORIES it would strip out the duplicate
parameters before calling ld.  It does not appear to be switched on in
this Ubuntu package I am using though. Is it on by default?


No.  It was introduced only to avoid an error in the linker in some
version of SGI Irix.  Generally the duplicate -L option does no harm.

I was actually thinking along of the lines of eliminating it earlier
in the process.  Why does the directory get in there twice in the
first place?


OK, yes I agree, the earlier the better. However, I don't (yet) know
enough about GCC, also, don't have time to scratch this itch currently.


To see what collect2 is doing, use -Wl,-debug

If I add this to my existing command line I see there not any output:
$ gcc -### -o t -Wl,-debug test.c

If I change to not have -### I see it does work, not sure why.


-### controls the gcc driver, not the collect2 program.


Ok, I realised -### means the commands are not executed, which 
explains why collect2 output was not visible.



So I understand that this passes -debug to collect2. As collect2 only
has -v mode to display version. Would a patch to add --help to it be
supported? Also could describe something about collect2's purpose at
the top of that --help output.


I think that ordinary uses of -Wl,--help will expect to see the --help
option for the linker, not for collect2.  That said, I think it would
be OK to add a --help option for collect2 which issued some output and
then went on to invoke the linker.


OK, I'll prepare a patch for this change. Also I'd like to add
--version alias of current -v too.


1) collect.c:scan_libraries may not find ldd, in which case it
displays message on output, and returns as normal. Should it not be
fatal if ldd is required?


It seems to me that it gives an error message, which should cause
collect2 to exit with a non-zero status.  Does that not happen for
you?  Note that ldd is only required on HP/UX.


Just checked again, you are correct.


2) in collect2.c:main "-debug" is checked, and variable debug set to 1
(perhaps that should be "true" to match the style of other flags)


Yes, and debug should be changed from int to bool.


Ok, I'll reply with a patch soon.

Something else, as there isn't a man page for collect2, could one be
created? I don't know if the -Wl,-debug option is documented somewhere
else currently. This is the only page I found:
http://gcc.gnu.org/onlinedocs/gccint/Collect2.html

Is there a way to get collect2 to save the temporary .c file it
generates to have a look at it? I believe it may be the __main() 
function, with the -debug option it gives the attached 
gplusplus_collect2_log.txt, looking at the [/tmp/ccyBAI9V.c] file 
though it is empty, any ideas?



I'm trying to build GCC trunk, with this line below. I've installed 
the mpfr, gmp and mpc dev packges for Ubuntu 9.10, so not sure where 
to investigate next


$ ./configure --with-mpfr=/usr --with-gmp=/usr -with-mpc=/usr

[snip]

checking for correct version of mpfr.h... yes
checking for the correct version of mpc.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.2+ and MPC 
0.8.0+.

Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html

Thank you for your help so far.

Please include my address in replies.

Cheers, Jon

j...@netbook:~/dev$ cat test.cpp
#include 
#include 

std::string hello("Hello world!");

int main(void)
{
printf("%s\n", hello.c_str());

return 0;
}

j...@netbook:~/dev$ g++ -Wl,-debug -o t test.cpp
Convert string 
'/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/:/usr/lib/gcc/i486-linux-gnu/4.4.1/:/usr/lib/gcc/i486-linux-gnu/'
 into prefixes, separator = ':'
  - add prefix: /usr/lib/gcc/i486-linux-gnu/4.4.1/
  - add prefix: /usr/lib/gcc/i486-linux-gnu/4.4.1/
  - add prefix: /usr/lib/gcc/i486-linux-gnu/
  - add prefix: /usr/lib/gcc/i486-linux-gnu/4.4.1/
  - add prefix: /usr/lib/gcc/i486-l

Re: Problems with `Installing GCC'

2010-02-02 Thread Joseph S. Myers
On Tue, 2 Feb 2010, Rainer Orth wrote:

> * The guide is far from complete: e.g., the libstdc++ configure options
>   are missing completely (they are documented in the XML/HTML manual,
>   but there's not even a pointer to that in the installation guide).  I

I noted that issue at least as far back as 
.  I'd still prefer all 
these options to be listed directly in the main installation manual, as I 
indicated in , 
and indeed for the separate subcomponent installation manuals to go away.

>   fear other libraries have similar problems: I've already printed the
>   output of configure --help for all in-tree configure scripts and plan
>   to check them against the installation guide.  On the other hand,
>   options described in the installation guide are missing from configure
>   --help (again, --with-llsc is an example).

You'll need to check for $enable_ and $with_ variables the scripts 
(including config.gcc etc.) are checking directly to find those.  Making 
them proper configure options that show up in --help would be a good idea, 
I think.

> ** it is highly inconsistent, like commands write with and without
>quotes, same for target triplets.

For target triplets, probably define a macro and then use that macro to 
mark them up everywhere.

> * It's unclear if we want to keep anything from `Old installation
>   documentation'.  This should be decided once and for all and then
>   either incorporated into the guide proper or dropped completely.

I'm not sure the cross-compile install concepts are explained elsewhere in 
the manual.  But see PR 5301; everyone uses or produces a script working 
for their use cases, rather than documentation, and probably no-one 
actually knows general rules covering every possible use case.

The list of short names for particular systems is old and pretty useless 
(actually, I'd rather config.sub ceased to support so many variants).  
Current lists of CPUs and OSes might be useful, but my preference would be 
for install.texi to list all supported triplets rather than fragments of 
them.

The *-local support should probably be removed, and the documentation 
removed with it.

-- 
Joseph S. Myers
jos...@codesourcery.com


gcc-4.4-20100202 is now available

2010-02-02 Thread gccadmin
Snapshot gcc-4.4-20100202 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.4-20100202/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.4 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-4_4-branch 
revision 156453

You'll find:

gcc-4.4-20100202.tar.bz2  Complete GCC (includes all of below)

gcc-core-4.4-20100202.tar.bz2 C front end and core compiler

gcc-ada-4.4-20100202.tar.bz2  Ada front end and runtime

gcc-fortran-4.4-20100202.tar.bz2  Fortran front end and runtime

gcc-g++-4.4-20100202.tar.bz2  C++ front end and runtime

gcc-java-4.4-20100202.tar.bz2 Java front end and runtime

gcc-objc-4.4-20100202.tar.bz2 Objective-C front end and runtime

gcc-testsuite-4.4-20100202.tar.bz2The GCC testsuite

Diffs from 4.4-20100126 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.4
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


Re: Long paths with ../../../../ throughout

2010-02-02 Thread Ian Lance Taylor
Jon  writes:

> Is there a way to get collect2 to save the temporary .c file it
> generates to have a look at it? I believe it may be the __main()
> function, with the -debug option it gives the attached
> gplusplus_collect2_log.txt, looking at the [/tmp/ccyBAI9V.c] file
> though it is empty, any ideas?

Using -debug will direct collect2 to save the temporary .c file when
it creates one.  However, in ordinary use on GNU/Linux, collect2 will
never generate a temporary .c file.


> checking for correct version of mpfr.h... yes
> checking for the correct version of mpc.h... no
> configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.2+ and MPC
> 0.8.0+.
> Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
> their locations.  Source code for these libraries can be found at
> their respective hosting sites as well as at
> ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
> http://gcc.gnu.org/install/prerequisites.html
>
> Thank you for your help so far.

Take a look at the config.log file to see the test that failed.

Ian


Re: Support for export keyword to use with C++ templates ?

2010-02-02 Thread Timothy Madden
On Mon, Feb 1, 2010 at 2:38 AM, Paolo Carlini  wrote:
> On 02/01/2010 01:26 AM, Timothy Madden wrote:
[...]
> As I see the issue, you should first check over the next months that the
> feature is not deprecated by ISO.
I know, I tried to talk about it on std.c++. I am afraid I can not see
a consensus in the end, still I would not say the committee will just
remove it. They were strongly against deprecation in 2003.

> Then start learning about the
> internals of GCC and eventually propose a detailed plan explaining how
> you want to attack the problem, because before that it's extremely
> unlikely that the C++ front-end maintainers could even consider
> reviewing patches from a novice for such an hard to implement feature.
Yes it is.
I wish there were a nice and easy way about it, but an attempt at
export is something quite big ...

> That said, if you *really* plan contributing to GCC, maybe outside
> export first (which seems a terribly good idea to me) first and
> foremost, read the relevant web page:
>
>   http://gcc.gnu.org/contribute.html
>
> and start immediately the paperwork for the Copyright assignment,
> because it takes time.

I see that what I need is an assignment for all future changes. If my
employer is not involved with any contributions of mine, the employer
disclaimer is not needed, right ?

It is going to be a while until I will be able to submit any kind of
patch; should I start with the paperwork ?

Thank you,
Timothy Madden


Re: Support for export keyword to use with C++ templates ?

2010-02-02 Thread Richard Kenner
> I see that what I need is an assignment for all future changes. If my
> employer is not involved with any contributions of mine, the employer
> disclaimer is not needed, right ?

It's safest to have it.  The best way to prove that your employer is
not involved with any contributions of yours is with such a disclaimer.


Re: Support for export keyword to use with C++ templates ?

2010-02-02 Thread Tim Prince

On 2/2/10 7:19 PM, Richard Kenner wrote:

I see that what I need is an assignment for all future changes. If my
employer is not involved with any contributions of mine, the employer
disclaimer is not needed, right ?
 

It's safest to have it.  The best way to prove that your employer is
not involved with any contributions of yours is with such a disclaimer.
   
Some employers have had a formal process for approving assignment of 
own-time contributions, as well as assignments as part of their 
business, and lack of either form of assignment indicates the employer 
has forbidden them.


--
Tim Prince