Re: PATCH RFA: Build stages 2 and 3 with C++

2011-07-15 Thread Andrew Pinski
On Fri, Jul 15, 2011 at 11:52 PM, Ian Lance Taylor  wrote:
> I would like to propose this patch as a step toward building gcc using a
> C++ compiler.  This patch builds stage1 with the C compiler as usual,
> and defaults to building stages 2 and 3 with a C++ compiler built during
> stage 1.  This means that the gcc installed and used by most people will
> be built by a C++ compiler.  This will ensure that gcc is fully
> buildable with C++, while retaining the ability to bootstrap with only a
> C compiler, not a C++ compiler.  This will permit us to experiment with
> optionally using C++ for some code, using a #ifdef to select the C
> implementation or the C++ implementation.
>
> I would suggest that we consider releasing 4.7 this way, as a small
> trial for building gcc with C++.

Do you build libstdc++ at stage1 also?  That is what happens if you
don't have a C++ compiler to begin with.

Thanks,
Andrew Pinski


PATCH RFA: Build stages 2 and 3 with C++

2011-07-15 Thread Ian Lance Taylor
I would like to propose this patch as a step toward building gcc using a
C++ compiler.  This patch builds stage1 with the C compiler as usual,
and defaults to building stages 2 and 3 with a C++ compiler built during
stage 1.  This means that the gcc installed and used by most people will
be built by a C++ compiler.  This will ensure that gcc is fully
buildable with C++, while retaining the ability to bootstrap with only a
C compiler, not a C++ compiler.  This will permit us to experiment with
optionally using C++ for some code, using a #ifdef to select the C
implementation or the C++ implementation.

I would suggest that we consider releasing 4.7 this way, as a small
trial for building gcc with C++.

This is a big step, so I am sending the patch to both gcc@ and
gcc-patches@ for comments.

Bootstrapped and ran testsuite on x86_64-unknown-linux-gnu.

Ian


2011-07-15  Ian Lance Taylor  

* configure.ac: Add --enable-build-poststage1-with-cxx.  If set,
make C++ a boot_language.  Set and substitute
POSTSTAGE1_CONFIGURE_FLAGS.
* Makefile.tpl (POSTSTAGE1_CONFIGURE_FLAGS): New variable.
(STAGE[+id+]_CONFIGURE_FLAGS): Add $(POSTSTAGE1_CONFIGURE_FLAGS).
* configure, Makefile.in: Rebuild.


Index: configure.ac
===
--- configure.ac	(revision 176348)
+++ configure.ac	(working copy)
@@ -1126,6 +1126,13 @@ AC_ARG_ENABLE(build-with-cxx,
 ENABLE_BUILD_WITH_CXX=$enableval,
 ENABLE_BUILD_WITH_CXX=no)
 
+# Build stage1 with C and build stages 2 and 3 with C++.
+AC_ARG_ENABLE(build-poststage1-with-cxx,
+[AS_HELP_STRING([--enable-build-poststage1-with-cxx],
+		[build stages 2 and 3 with C++, not C])],
+ENABLE_BUILD_POSTSTAGE1_WITH_CXX=$enableval,
+ENABLE_BUILD_POSTSTAGE1_WITH_CXX=yes)
+
 # Used for setting $lt_cv_objdir
 _LT_CHECK_OBJDIR
 
@@ -1696,9 +1703,11 @@ if test -d ${srcdir}/gcc; then
   exit 1
 fi
 
-	if test "$language" = "c++" \
-	   && test "$ENABLE_BUILD_WITH_CXX" = "yes"; then
-	  boot_language=yes
+	if test "$language" = "c++"; then
+	  if test "$ENABLE_BUILD_WITH_CXX" = "yes" \
+	 || test "$ENABLE_BUILD_POSTSTAGE1_WITH_CXX" = "yes"; then
+	boot_language=yes
+	  fi
 	fi
 
 case ,${enable_languages}, in
@@ -2397,10 +2406,10 @@ case "$have_compiler:$host:$target:$enab
 ;;
 esac
 
-case ",$enable_languages,:$ENABLE_BUILD_WITH_CXX:$enable_bootstrap" in
-  *,c++,*:yes:yes) ;;
-  *:yes:yes)
-AC_MSG_ERROR([bootstrapping with --enable-build-with-cxx requires c++ in --enable-languages])
+case ",$enable_languages,:,$ENABLE_BUILD_WITH_CXX,$ENABLE_BUILD_POSTSTAGE1_WITH_CXX,:$enable_bootstrap" in
+  *,c++,*:*:*) ;;
+  *:*,yes,*:yes)
+AC_MSG_ERROR([bootstrapping with --enable-build-with-cxx or --enable-build-postage1-with-cxx requires c++ in --enable-languages])
 ;;
 esac
 
@@ -3188,6 +3197,15 @@ case ${enable_werror} in
 esac
 AC_SUBST(stage2_werror_flag)
 
+# If using ENABLE_BUILD_POSTSTAGE1_WITH_CXX, pass
+# --enable-build-with-cxx after stage1.
+if test "$ENABLE_BUILD_POSTSTAGE1_WITH_CXX" = "yes"; then
+  POSTSTAGE1_CONFIGURE_FLAGS=--enable-build-with-cxx
+else
+  POSTSTAGE1_CONFIGURE_FLAGS=
+fi
+AC_SUBST(POSTSTAGE1_CONFIGURE_FLAGS)
+
 # Specify what files to not compare during bootstrap.
 
 compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
Index: Makefile.tpl
===
--- Makefile.tpl	(revision 176348)
+++ Makefile.tpl	(working copy)
@@ -416,6 +416,7 @@ TFLAGS =
 STAGE_CFLAGS = $(BOOT_CFLAGS)
 STAGE_TFLAGS = $(TFLAGS)
 STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@
+POSTSTAGE1_CONFIGURE_FLAGS = @POSTSTAGE1_CONFIGURE_FLAGS@
 
 [+ FOR bootstrap-stage +]
 # Defaults for stage [+id+]; some are overridden below.
@@ -426,7 +427,10 @@ STAGE[+id+]_CXXFLAGS = $(CXXFLAGS)
 STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS)
 @endif target-libstdc++-v3-bootstrap
 STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS)
-STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS)
+# STAGE1_CONFIGURE_FLAGS overridden below, so we can use
+# POSTSTAGE1_CONFIGURE_FLAGS here.
+STAGE[+id+]_CONFIGURE_FLAGS = \
+	$(STAGE_CONFIGURE_FLAGS) $(POSTSTAGE1_CONFIGURE_FLAGS)
 [+ ENDFOR bootstrap-stage +]
 
 # Only build the C compiler for stage1, because that is the only one that
@@ -444,6 +448,9 @@ STAGE1_LANGUAGES = @stage1_languages@
 #   the last argument when conflicting --enable arguments are passed.
 # * Likewise, we force-disable coverage flags, since the installed
 #   compiler probably has never heard of them.
+# * Don't remove this, because above we added
+#   POSTSTAGE1_CONFIGURE_FLAGS to STAGE[+id+]_CONFIGURE_FLAGS, which
+#   we don't want for STAGE1_CONFIGURE_FLAGS.
 STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
 	  --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)"
 
Index: gcc/doc/install.texi
===
--- gcc/doc/install.texi	(revision 176348)

Updating the CFG after function modifcation

2011-07-15 Thread Matt Davis
Hello,
I have an IPA pass (implemented as a plugin) which executes after all IPA
passes.  My pass transforms functions by adding code and also modifying the
function prototypes.  I have had this work on a per-function basis, via a
GIMPLE_PASS, which calls update_ssa verify_ssa and cleanup_cfg after each
function is processed.  However, I have recently moved my plugin to execute
after all IPA passes, so I can iterate over the cfg of the program.  The first
iteration is an analysis, and the second iteration does the transformations.
Unfortunately, I keep getting errors now, primarily a segfault in
"compute_call_stmt_bb_frequency" in the processing of the main().  The segfault
occurs because the argument 'bb' is NULL and later dereferenced.  (NOTE: I do
not modify the prototype of main).

The e->call_stmt that the null basic block references is from a statement I have
removed via gsi_remove during my transformation pass.  I need to clean up the
cfg somehow, after I remove the statement.  My gimple pass, with this same
functionality worked fine.  Something tells me that my plugin should be in a
different position.  I also tried calling cleanup_tree_cfg() after my
transformation pass, still no luck

Any suggestions would be welcomed.  Thanks for even reading this far.

-Matt


Re: Interested In Doing Documentation Project

2011-07-15 Thread Philip Herron
On 16 July 2011 04:07, selma leathem  wrote:
> -- Forwarded message --
> From: selma leathem 
> Date: Fri, Jul 15, 2011 at 8:50 PM
> Subject: Interested In Doing Documentation Project
> To: gcc@gcc.gnu.org
>
> Hello,
>
> I am interested in doing the front end documentation project. How do I
> sign up for that, or learn what is going on with it at this current
> time please?
>
> I am an ex-physicist with some computing including c/c++ and technical
> writing experience who is trying to gain more experience in this area.
>
> Thank you,
>
> Selma Leathem
>

Andi Hellmund and i have actually done alot of work into front-end
documentation work maybe you could sync with us if your interested how
did you find this as a project and what are you interested in?


Re: Fwd: Interested In Doing Documentation Project

2011-07-15 Thread Ruben Safir
On Fri, Jul 15, 2011 at 09:07:46PM -0600, selma leathem wrote:
> -- Forwarded message --
> From: selma leathem 
> Date: Fri, Jul 15, 2011 at 8:50 PM
> Subject: Interested In Doing Documentation Project
> To: gcc@gcc.gnu.org
> 
> Hello,
> 
> I am interested in doing the front end documentation project. How do I
> sign up for that, or learn what is going on with it at this current
> time please?
> 
> I am an ex-physicist with some computing including c/c++ and technical
> writing experience who is trying to gain more experience in this area.
> 
> Thank you,
> 
> Selma Leathem


It;s a good thing.  If you are looking for a project, I'd focus on
ncurses which needs a top notch (better than I) coder to document it
better, especially the C++ binding,

   Ruben
-- 
http://www.mrbrklyn.com - Interesting Stuff
http://www.nylxs.com - Leadership Development in Free Software

So many immigrant groups have swept through our town that Brooklyn, like 
Atlantis, reaches mythological proportions in the mind of the world  - RI Safir 
1998

http://fairuse.nylxs.com  DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

"Yeah - I write Free Software...so SUE ME"

"The tremendous problem we face is that we are becoming sharecroppers to our 
own cultural heritage -- we need the ability to participate in our own society."

"> I'm an engineer. I choose the best tool for the job, politics be damned.<
You must be a stupid engineer then, because politcs and technology have been 
attached at the hip since the 1st dynasty in Ancient Egypt.  I guess you missed 
that one."

© Copyright for the Digital Millennium


Fwd: Interested In Doing Documentation Project

2011-07-15 Thread selma leathem
-- Forwarded message --
From: selma leathem 
Date: Fri, Jul 15, 2011 at 8:50 PM
Subject: Interested In Doing Documentation Project
To: gcc@gcc.gnu.org

Hello,

I am interested in doing the front end documentation project. How do I
sign up for that, or learn what is going on with it at this current
time please?

I am an ex-physicist with some computing including c/c++ and technical
writing experience who is trying to gain more experience in this area.

Thank you,

Selma Leathem


gcc-4.6-20110715 is now available

2011-07-15 Thread gccadmin
Snapshot gcc-4.6-20110715 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.6-20110715/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

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

You'll find:

 gcc-4.6-20110715.tar.bz2 Complete GCC

  MD5=e0ae8ffc086da6cb35d2388cdfd491d6
  SHA1=fc8f7ea110890a2f2692be6a3dad16eca59f4cd6

Diffs from 4.6-20110708 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.6
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.


gcc-python-plugin status update: static analysis, and HTML reports

2011-07-15 Thread David Malcolm
I've written up a status update on the gcc-python-plugin on my blog
here:
http://dmalcolm.livejournal.com/6560.html

Summarizing that blog post, I've revamped the internals of how my
checker script so that it can detect various kinds of CPython reference
count bug, and it can now render bug reports as both regular text on
stderr, and in HTML form:
http://fedorapeople.org/~dmalcolm/blog/2011-07-15/refcount_demo-refcount-errors.html

(you may need a modern browser to see the control flow annotations in
the HTML, as it uses JavaScript and the  element; there are
screenshots in the blog post)

Detecting the all-too-common: "return Py_None;" bug:
http://fedorapeople.org/~dmalcolm/blog/2011-07-15/losing_refcnt_of_none-refcount-errors.html


Detecting a (contrived) reference leak:
http://fedorapeople.org/~dmalcolm/blog/2011-07-15/object_leak-refcount-errors.html


Detecting a stray Py_INCREF that makes the reference count too high, or
segfaults python, depending on what happened earlier within the
function:
http://fedorapeople.org/~dmalcolm/blog/2011-07-15/too_many_increfs-refcount-errors.html


Some of that rendering code might be of use to other users of the
plugin; has anyone else rendered HTML reports from within GCC?


I didn't discuss implementation details in the blog post, but given the
audience on these lists, it's probably on-topic to mention here:

It works by a rather crude implementation of abstract interpretation,
tracking all possible paths through the function, generating traces of
execution.  (It currently will fail horribly when it encounters a loop;
I suspect I need widening/narrowing operators, and to read a lot more
papers on the subject :) )

Internally, the analyser models the memory state using a method similar
to the one used by LLVM's clang static analyser, as described in:
"A Memory Model for Static Analysis of C Programs" (Zhongxing Xu, Ted
Kremenek, and Jian Zhang)

thus handling pointers and dereferences (though my implementation is
very much an early prototype as this stage).

I've added a new (as far as I know) class of abstract value representing
"all reference counts that the function owns" (i.e. an integer value,
relative to the unknown refcount owned by all of the rest of the
program).


Hope this is helpful/interesting
Dave



Re: How to fix my account on gnu.org?

2011-07-15 Thread Ian Lance Taylor
"H.J. Lu"  writes:

> On Fri, Jul 15, 2011 at 11:57 AM, Andreas Schwab  
> wrote:
>> Ian Lance Taylor  writes:
>>
>>> "H.J. Lu"  writes:
>>>
 I haven't used my gnu.org account for a long time, h...@gnu.org.  I can't 
 log in
 nor my email forward doesn't work either.
>>>
>>> You are asking about gnu.org, not gcc.gnu.org, right?  I think you have
>>> to ask sysad...@gnu.org about that.
>>>
>>> Normally you should be able to ssh to fp.gnu.org.  I don't see you in
>>> /etc/passwd there, though.
>>
>> AFAIU nowadays accounts on fp.gnu.org are restricted to GNU maintainers.
>>
>
> Do binutils maintainers count?

I think you have to ask sysad...@gnu.org.  As far as I know they do not
read gcc@gcc.gnu.org.

Ian


Re: How to fix my account on gnu.org?

2011-07-15 Thread H.J. Lu
On Fri, Jul 15, 2011 at 11:57 AM, Andreas Schwab  wrote:
> Ian Lance Taylor  writes:
>
>> "H.J. Lu"  writes:
>>
>>> I haven't used my gnu.org account for a long time, h...@gnu.org.  I can't 
>>> log in
>>> nor my email forward doesn't work either.
>>
>> You are asking about gnu.org, not gcc.gnu.org, right?  I think you have
>> to ask sysad...@gnu.org about that.
>>
>> Normally you should be able to ssh to fp.gnu.org.  I don't see you in
>> /etc/passwd there, though.
>
> AFAIU nowadays accounts on fp.gnu.org are restricted to GNU maintainers.
>

Do binutils maintainers count?


-- 
H.J.


Re: How to fix my account on gnu.org?

2011-07-15 Thread Andreas Schwab
Ian Lance Taylor  writes:

> "H.J. Lu"  writes:
>
>> I haven't used my gnu.org account for a long time, h...@gnu.org.  I can't 
>> log in
>> nor my email forward doesn't work either.
>
> You are asking about gnu.org, not gcc.gnu.org, right?  I think you have
> to ask sysad...@gnu.org about that.
>
> Normally you should be able to ssh to fp.gnu.org.  I don't see you in
> /etc/passwd there, though.

AFAIU nowadays accounts on fp.gnu.org are restricted to GNU maintainers.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Re: How to fix my account on gnu.org?

2011-07-15 Thread Ian Lance Taylor
"H.J. Lu"  writes:

> I haven't used my gnu.org account for a long time, h...@gnu.org.  I can't log 
> in
> nor my email forward doesn't work either.

You are asking about gnu.org, not gcc.gnu.org, right?  I think you have
to ask sysad...@gnu.org about that.

Normally you should be able to ssh to fp.gnu.org.  I don't see you in
/etc/passwd there, though.

Ian


How to fix my account on gnu.org?

2011-07-15 Thread H.J. Lu
Hi,

I haven't used my gnu.org account for a long time, h...@gnu.org.  I can't log in
nor my email forward doesn't work either.

-- 
H.J.


Need clarification for PPC floating Point compiler options

2011-07-15 Thread Rohit Arul Raj
Hello All,

I have a few clarification with the PPC floating point compiler options.
I am working with v4.4.1 (e500mc) but i think it applies to 4.6 as well.

1. -msingle-float:

 With this option, i get a compiler warning: "-msingle-float option
equivalent to -mhard-float" which means both the single-float and
double-float flags should be set.
 But in the back-end file config/rs6000/rs6000.c,  rs6000_double_float
is set to 0.

case OPT_msingle_float:
 if (!TARGET_SINGLE_FPU)
  warning (0, "-msingle-float option equivalent to -mhard-float");
 /* -msingle-float implies -mno-double-float and TARGET_HARD_FLOAT. */
rs6000_double_float = 0;
target_flags &= ~MASK_SOFT_FLOAT;
target_flags_explicit |= MASK_SOFT_FLOAT;
  break;

  Still the FP code gets generated for both float and double. Do we
have any other target flag/macro which overrides 'rs6000_double_float'
flag?

2. -mfpu=none

  I expected this option to behave like '-msoft-float', but it works
like '-mhard-float'.
  The comments and internal flags in the target source file also
mention the same.

  case OPT_mfpu_:
  if (fpu_type != FPU_NONE)
  /* If -mfpu is not none, then turn off SOFT_FLOAT, turn on HARD_FLOAT. */
  {
 ...
  }
  else
  {
/* -mfpu=none is equivalent to -msoft-float */
target_flags |= MASK_SOFT_FLOAT;
target_flags_explicit |= MASK_SOFT_FLOAT;
rs6000_single_float = rs6000_double_float = 0;
}

3. powerpc-linux-gcc --help gives the following text for -mfpu:

  -mfpu=  Specify FP (sp, dp, sp-lite,
dp-lite) (implies -mxilinx-fpu)

 There seems to be a typo here as the supported options are:
"none", "sp_lite", "dp_lite", "sp_full", "dp_full"

  static enum fpu_type_t
 rs6000_parse_fpu_option (const char *option)
 {
 if (!strcmp("none", option)) return FPU_NONE;
 if (!strcmp("sp_lite", option)) return FPU_SF_LITE;
 if (!strcmp("dp_lite", option)) return FPU_DF_LITE;
 if (!strcmp("sp_full", option)) return FPU_SF_FULL;
 if (!strcmp("dp_full", option)) return FPU_DF_FULL;

4.  What is the purpose of this option? "-mfloat-gprs="

 when passed "yes/single/double", they generate instructions like
"efsmul" for a simple float multiplication statement which belong to
SPE engine.
 Since e500mc doesn't support SPE instruction set and if
"-mfloat-gprs=" enables them then should this option throw an
warning/error?

Regards,
Rohit