[PATCH 01/13] Initial import of asan from the Google branch

2012-11-01 Thread dodji
From: dnovillo This patch merely imports the initial state of asan as it was in the Google branch. It provides basic infrastructure for asan to instrument memory accesses on the heap, at -O3. Note that it supports neither stack nor global variable protection. The rest of the patches of the set

[PATCH 03/13] Initial asan cleanups

2012-11-01 Thread dodji
From: jakub This patch defines a new asan_shadow_offset target macro, instead of having a mere macro in the asan.c file. It becomes thus cleaner to define the target macro for targets that supports asan, namely x86 for now. The ASAN_SHADOW_SHIFT (which, along with the asan_shadow_offset constan

[PATCH 09/13] Don't forget to protect 32 bytes aligned global variables.

2012-11-01 Thread dodji
From: wmi It appeared that we were forgetting to protect global variables that are already 32 bytes aligned. Fixed thus. * varasm.c (assemble_variable): Set asan_protected even for decls that are already ASAN_RED_ZONE_SIZE or more bytes aligned. git-svn-id: svn+ssh://gc

[PATCH 02/13] Rename tree-asan.[ch] to asan.[ch]

2012-11-01 Thread dodji
From: dnovillo Following a discussion we had on this list, this patch renames the file tree-asan.* into asan.*. * asan.c: Rename from tree-asan.c. Update all users. * asan.h: Rename from tree-asan.h Update all users. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/bran

[PATCH 11/13] Factorize condition insertion code out of build_check_stmt

2012-11-01 Thread dodji
From: dodji This patch splits a new create_cond_insert_point_before_iter function out of build_check_stmt, to be used by a later patch. Tested by running cc1 -fasan on the test program below with and without the patch and by inspecting the gimple output to see that there is no change. void foo

[PATCH 05/13] Allow asan at -O0

2012-11-01 Thread dodji
From: jakub This patch defines a new asan pass gate that is activated at -O0, in addition to the -O3 level at which it was initially activated. The patch also does some comment cleanups here and there. * asan.c (build_check_stmt): Rename join_bb variable to else_bb. (gate_asan_O

[PATCH 08/13] Fix a couple of ICEs.

2012-11-01 Thread dodji
From: jakub After the previous patches uncovered the fact a NOTE_INSN_BASIC_BLOCK could show up in the middle of a basic block and thus violating an important invariant. THe cfgexpand.c hunk fixes that. Then it appeared that we could get tree sharing violation if build_check_stmt doesn't unshar

[PATCH 00/13] Request to merge Address Sanitizer in

2012-11-01 Thread dodji
From: Dodji Seketeli Hello, The set of patches following this message represents the work that happened on the asan branch to build up the Address Sanitizer work started in the Google branch. Address Sanitizer (aka asan) is a memory error detector. It finds use-after-free and {heap,stack

[PATCH 10/13] Make build_check_stmt accept an SSA_NAME for its base

2012-11-01 Thread dodji
From: dodji This patch makes build_check_stmt accept its memory access parameter to be an SSA name. This is useful for a subsequent patch that will re-use. Tested by running cc1 -fasan on the program below with and without the patch and inspecting the gimple output to see that there is no

[PATCH 04/13] Emit GIMPLE directly instead of gimplifying GENERIC.

2012-11-01 Thread dodji
From: jakub This patch cleanups the instrumentation code generation by emitting GIMPLE directly, as opposed to emitting GENERIC tree and then gimplifying them. It also does some cleanups here and there * Makefile.in (GTFILES): Add $(srcdir)/asan.c. * asan.c (shadow_ptr_types): N

[PATCH 06/13] Implement protection of stack variables

2012-11-01 Thread dodji
From: jakub This patch implements the protection of stack variables. To understand how this works, lets look at this example on x86_64 where the stack grows downward: int foo () { char a[23] = {0}; int b[2] = {0}; a[5] = 1; b[1] = 2; return a[5] + b[1]; } For this function

[PATCH 07/13] Implement protection of global variables

2012-11-01 Thread dodji
From: jakub This patch implements the protection of global variables. The basic idea is to insert a red zone between two global variables and install a constructor function that calls the asan runtime to do the populating of the relevant shadow memory regions at load time. So the patch lays out

[PATCH 12/13] Instrument built-in memory access function calls

2012-11-01 Thread dodji
From: dodji This patch instruments many memory access patterns through builtins. Basically, for a call like: __builtin_memset (from, 0, n_bytes); the patch would only instrument the accesses at the beginning and at the end of the memory region [from, from + n_bytes]. This is the

[PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)

2013-09-04 Thread Dodji Seketeli
ese comments right in tree.h so that they are easier to find next time. OK to commit this comment-only patchlet to trunk then? Thanks. From 1ad29143764a72d27b1ecf3c06b4ba72bfaf4fe8 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 4 Sep 2013 10:32:36 +0200 Subject: [PATCH] More comm

Re: [PATCH] More comments about DECL_BUILT_IN and DECL_IS_BUILTIN (was Re: Why DECL_BUILT_IN and DECL_IS_BUILTIN?)

2013-09-05 Thread Dodji Seketeli
Ian Lance Taylor a écrit: > On Wed, Sep 4, 2013 at 1:46 AM, Dodji Seketeli wrote: >> >> +/* In a FUNCTION_DECL, nonzero means a built in function of a >> + standard library or more generally a built in function that is >> + recognized by optimizers and expanders.

Re: [ping] [PATCH] Silence an unused variable warning

2013-09-27 Thread Dodji Seketeli
^ > [...] > > Ping: > > http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01568.html > `--> http://gcc.gnu.org/ml/gcc-patches/2013-09/txtnrNwaGiD3x.txt > > MfG, JBG -- Dodji

[PATCH] PR c++/54401 - Confusing diagnostics about type-alias at class scope

2012-09-28 Thread Dodji Seketeli
le mode 100644 index 000..086b5e5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-23.C @@ -0,0 +1,7 @@ +// Origin: PR c++/54401 +// { dg-do compile { target c++11 } } + +template +struct X { +using type = T; // { dg-error "expected type-specifier|does not name a type" } +}; -- 1.7.11.4 -- Dodji

Re: [C++ PATCH] -Wsizeof-pointer-memaccess warning (take 2)

2012-10-03 Thread Dodji Seketeli
hat we just use maybe_constant_value here? Even after reading the comments of these two functions, /having/ to use them like this seems confusing to the casual reader in me. -- Dodji

Re: [PATCH] PR 53528 c++/ C++11 Generalized Attribute support

2012-10-08 Thread Dodji Seketeli
Jason Merrill writes: > OK. Thanks. Committed to trunk at revision r192199. -- Dodji

PING Re: [PATCH] PR c++/53540 - using fails to be equivalent to typedef

2012-10-08 Thread Dodji Seketeli
Friendly pinging this patch. Dodji Seketeli writes: > Hello, > > In the example of this problem report, during the substituting of int > into 'function', tsubst_aggr_type fails for the alias ctxt1. This is > because TYPE_TEMPLATE_INFO looks for the TEMPLATE_INFO of

Re: [PATCH] PR 53528 c++/ C++11 Generalized Attribute support

2012-10-09 Thread Dodji Seketeli
test for excess errors) > FAIL: g++.dg/cpp0x/gen-attrs-8.C (test for warnings, line 5) > FAIL: g++.dg/cpp0x/gen-attrs-8.C (test for excess errors) Thank you for the heads-up. I am currently testing a patch for these. Sorry for the inconvenience. -- Dodji

Re: Build failure with "[PATCH] PR 53528 c++/ C++11 Generalized Attribute support"

2012-10-09 Thread Dodji Seketeli
Hans-Peter Nilsson writes: > This caused a build failure, see PR54860. I am on it. Sorry for the inconvenience. -- Dodji

Re: [PATCH] PR c++/53540 - using fails to be equivalent to typedef

2012-10-09 Thread Dodji Seketeli
def int type; +}; + +template +void function() +{ + using ctx1 = context; + typename ctx1::type f1; + + typedef context ctx2; + typename ctx2::type f2; +} + +int main() +{ + function(); +} + -- Dodji

[PATCH 0/3] Fix fallouts from c++11 attributes work

2012-10-09 Thread Dodji Seketeli
+++- gcc/testsuite/g++.dg/cpp0x/gen-attrs-8.C | 2 +- 5 files changed, 27 insertions(+), 10 deletions(-) -- Dodji

[PATCH 1/3] Disambiguate nested objc-message-expressions and c++11 attributes

2012-10-09 Thread Dodji Seketeli
ment (parser); + else + /* Warn about parsing c++11 attribute in non-c++1 mode, only + when we are sure that we have actually parsed them. */ + maybe_warn_cpp0x (CPP0X_ATTRIBUTES); } else { -- Dodji

[PATCH 2/3] Update g++.dg/cpp0x/gen-attrs-{8,36,37}.C as c++11 attributes to types are ignored

2012-10-09 Thread Dodji Seketeli
pected" } -int * [[gnu::stdcall]] myFn01( void) { return 0; }// { dg-warning "attribute only applies to function types" } +int * [[gnu::stdcall]] myFn01( void) { return 0; }// { dg-warning "ignored" } -- 1.7.11.4 -- Dodji

[PATCH 3/3] PR middle-end/54860 - Make sure attributes hash table is created

2012-10-09 Thread Dodji Seketeli
ce->attribute_hash != NULL); str.str = attr->name; str.length = strlen (str.str); -- Dodji

Re: [PATCH] PR 53528 c++/ C++11 Generalized Attribute support

2012-10-10 Thread Dodji Seketeli
rors) > FAIL: g++.dg/cpp0x/gen-attrs-8.C (test for warnings, line 5) > FAIL: g++.dg/cpp0x/gen-attrs-8.C (test for excess errors) These should now be fixed in trunk by revision r192300. Cheers. -- Dodji

Re: [C++] Omit overflow check for new char[n]

2012-10-10 Thread Dodji Seketeli
EW_USES_COOKIE is set. Is it still used? -- Dodji

Re: [C++] Omit overflow check for new char[n]

2012-10-11 Thread Dodji Seketeli
Florian Weimer a écrit: > On 10/10/2012 06:02 PM, Dodji Seketeli wrote: > >> I just have one question for own education. >> >> Regarding: >> >> @@ -2450,7 +2450,13 @@ >>if (array_p && TYPE_VEC_NEW_USES_COOKIE (elt_type)) >>

[PATCH] Cleanup comments in alias.c

2012-10-15 Thread Dodji Seketeli
irst, but does not contain the fields whose address are never + taken. For types that do escape the compilation unit, the data + structures will have identical information. */ /* The alias sets assigned to MEMs assist the back-end in determining -- Dodji

Re: PR c++/54928 infinite ICE when reporting ICE on macro expansion

2012-10-17 Thread Dodji Seketeli
iners think otherwise, I'll abide. > Dodji, does it look ok? I am not sure how much testsuite coverage we > have for the macro unwinder, so I hope I didn't mess it up in some > non-trivial testcase. The test cases for the unwinder are not really tight. They are mainly gcc.dg/

Re: [patch] PR 54930: add -Wreturn-local-addr

2012-10-21 Thread Dodji Seketeli
s errors" "" {target "*-*-*"} > 0 } > + > +int& bad1() > +{ > + int x = 0; // { dg-error "reference to local variable" } > + return x; > +} > + > +int* bad2() > +{ > + int x = 0; // { dg-error "address of local variable" } > + return &x; > +} > + > +const int& bad4() > +{ > + return int(); // { dg-error "returning reference to > temporary" } > +} > diff --git a/gcc/testsuite/gcc.dg/Wreturn-local-addr.c > b/gcc/testsuite/gcc.dg/Wreturn-local-addr.c > new file mode 100644 > index 000..d496d20 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/Wreturn-local-addr.c > @@ -0,0 +1,9 @@ > +/* { dg-do assemble } */ > +/* { dg-options "-Werror=return-local-addr" } */ > +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} > 0 } */ > + > +int* bad() > +{ > + int x = 0; > + return &x; /* { dg-error "address of local variable" } */ > +} -- Dodji

[PATCH 0/3][asan] Instrument memory access builtins calls

2012-10-23 Thread Dodji Seketeli
_stmt [asan] Instrument built-in memory access function calls gcc/asan.c | 482 + 1 file changed, 419 insertions(+), 63 deletions(-) -- Dodji

[PATCH 1/3] [asan] Make build_check_stmt accept an SSA_NAME for its base

2012-10-23 Thread Dodji Seketeli
fter (&gsi, g, GSI_NEW_STMT); base_addr = gimple_assign_lhs (g); -- Dodji

[PATCH 2/3] [asan] Factorize condition insertion code out of build_check_stmt

2012-10-23 Thread Dodji Seketeli
&then_bb, + &else_bb); base = unshare_expr (base); - gsi = gsi_last_bb (cond_bb); - /* If BASE can already be an SSA_NAME; in that case, do not create a new SSA_NAME for it. */ if (TREE_CODE (base) != SSA_NAME) -- 1.7.11.7 -- Dodji

[PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-23 Thread Dodji Seketeli
s), false); + gimple s = gsi_stmt (i); + + if (gimple_assign_single_p (s)) + instrument_assignment (&i); + else if (is_gimple_call (s)) + maybe_instrument_call (&i); } } } -- Dodji

Re: [PATCH 2/3] [asan] Factorize condition insertion code out of build_check_stmt

2012-10-24 Thread Dodji Seketeli
Jakub Jelinek writes: > On Tue, Oct 23, 2012 at 03:08:07PM +0200, Dodji Seketeli wrote: >> +static gimple_stmt_iterator >> +create_cond_insert_point_before_iter (gimple_stmt_iterator *iter, >> + bo

Re: [PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-24 Thread Dodji Seketeli
Jakub Jelinek writes: > On Tue, Oct 23, 2012 at 03:11:29PM +0200, Dodji Seketeli wrote: >> + /* (src, n) style memops. */ >> +case BUILT_IN_STRNDUP: >> + source0 = gimple_call_arg (call, 0); >> + len = gimple_call_arg (call, 1); >> +

Re: [PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-24 Thread Dodji Seketeli
he first byte > before the call and the last one after the call). How do I get the result of the (strlen) call in gimple? -- Dodji

Re: [PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-24 Thread Dodji Seketeli
Jakub Jelinek writes: > On Wed, Oct 24, 2012 at 05:16:26PM +0200, Dodji Seketeli wrote: >> Jakub Jelinek writes: >> >> >> For 'strlen', can the memory check be done at the end of the string >> >> using the returned length? >> > >

Re: PR c++/54928 infinite ICE when reporting ICE on macro expansion

2012-10-24 Thread Dodji Seketeli
These bits looks good to me, barring ... [...] > +void > +diagnostic_attach_note (diagnostic_context *context, > +location_t location, > +const char * gmsgid, ...) > +{ ... this function that lacks a comment. Thanks. -- Dodji

Re: [PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-25 Thread Dodji Seketeli
itpos % (size_in_bytes * BITS_PER_UNIT) ? > 1 byte or 2 byte access at bitpos 80 is fine, but 4 byte access is not. Of course it should be that. I have updated the patch. Jakub Jelinek writes: > On Wed, Oct 24, 2012 at 05:16:26PM +0200, Dodji Seketeli wrote: >> Jakub

Re: [PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-25 Thread Dodji Seketeli
instrument_derefs (&i, gimple_assign_lhs (s), - gimple_location (s), true); - instrument_derefs (&i, gimple_assign_rhs1 (s), - gimple_location (s), false); + gimple s = gsi_stmt (i); + + if (gimple_assign_single_p (s)) + instrument_assignment (&i); + else if (is_gimple_call (s)) + maybe_instrument_call (&i); } } } -- 1.7.11.7 -- Dodji

Re: [PATCH 3/3] [asan] Instrument built-in memory access function calls

2012-10-26 Thread Dodji Seketeli
block) continue; for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) { - gimple s = gsi_stmt (i); - if (!gimple_assign_single_p (s)) - continue; - instrument_derefs (&i, gimple_assign_lhs (s), - gimple_location (s), true); - instrument_derefs (&i, gimple_assign_rhs1 (s), - gimple_location (s), false); + gimple s = gsi_stmt (i); + + if (gimple_assign_single_p (s)) + instrument_assignment (&i); + else if (is_gimple_call (s)) + maybe_instrument_call (&i); } } } -- Dodji

[PATCH] PR c++/54955 - Fail to parse alignas expr at the beginning of a declaration

2012-10-26 Thread Dodji Seketeli
000..3cc5897 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-48-2.C @@ -0,0 +1,4 @@ +// Origin: PR c++/54955 +// { dg-do compile { target c++11 } } + +alignas(double) int f; -- 1.7.11.7 -- Dodji

Re: [PATCH] PR c++/54955 - Fail to parse alignas expr at the beginning of a declaration

2012-10-27 Thread Dodji Seketeli
Jason Merrill writes: > On 10/26/2012 01:37 PM, Dodji Seketeli wrote: >> cp_next_tokens_can_be_std_attribute_p (cp_parser *parser) >> { >> - return cp_nth_tokens_can_be_std_attribute_p (parser, 1); >> + cp_token *token = cp_lexer_peek_token (parser->lexer);

[PATCH] PR c++/54466 - ICE with alias template which type-id is const qualified

2012-10-27 Thread Dodji Seketeli
n the main variant of the type. gcc/testsuite/ * g++.dg/cpp0x/alias-decl-25.C: New test file. In the example of this patch, g++ crashes when trying to build the alias template Y + struct X { }; + +template + using Y = const X; + +using Z = Y; -- Dodji

Re: [PATCH, PR 53001] Re: Patch to split out new warning flag for floating point conversion

2013-10-14 Thread Dodji Seketeli
on between signed and unsigned integers > +which are all warned about immediately, so this is unused > + UNSAFE_REAL Conversions that reduce the precision of reals > +including conversions from reals to integers > + */ > +enum conversion_safety { SAFE_CONVERSION = 0, UNSAFE_OTHER, UNSAFE_SIGN, > UNSAFE_REAL }; > + [...] Other than these nits, the patch looks nice to me. Thank you for working on this. -- Dodji

Re: [PATCH, PR 53001] Re: Patch to split out new warning flag for floating point conversion

2013-10-28 Thread Dodji Seketeli
ld say that this is a new file. Here what it says is that it's a modification of an existing file. Thank you for your time on this. -- Dodji

Re: [PATCH, PR 53001] Re: Patch to split out new warning flag for floating point conversion

2013-10-28 Thread Dodji Seketeli
"Joseph S. Myers" writes: > On Mon, 28 Oct 2013, Dodji Seketeli wrote: > >> * c-family/c-common.c (unsafe_conversion_p): Make this function > > As previously noted, c-family/ has its own ChangeLog, so the c-family/ > part does not go in the ChangeLog

[PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-10-31 Thread Dodji Seketeli
Hello, In this problem report, the compiler is fed a (bogus) translation unit in which some literals contains bytes whose value is zero. The preprocessor detects that and proceeds to emit diagnostics for that king of bogus literals. But then when the diagnostics machinery re-reads the input file

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-10-31 Thread Dodji Seketeli
ine(3) would be much better for this purpose, though of course > it is a GNU extension in glibc and so we'd need some fallback, which > very well could be the fgetc or something similar. So would getline (+ the current patch as a fallback) be acceptable? -- Dodji

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-04 Thread Dodji Seketeli
Jakub Jelinek writes: > I think even as a fallback is the patch too expensive. > I'd say best would be to write some getline API compatible function > and just use it, using fread on say fixed size buffer. OK, thanks for the insight. I have just used the getline_fallback function you proposed,

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-04 Thread Dodji Seketeli
ion with the gcov module. -- Dodji

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-04 Thread Dodji Seketeli
Jakub Jelinek writes: [...] > Eventually, I think using int for sizes is just a ticking bomb, what if > somebody uses > 2GB long lines? Surely, on 32-bit hosts we are unlikely to > handle it, but why couldn't 64-bit host handle it? Column info maybe bogus > in there, sure, but at least we shou

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-05 Thread Dodji Seketeli
Bernd Edlinger writes: [...] >> if (!string_len) >> { >> string_len = 200; >> - string = XNEWVEC (char, string_len); >> + string = XCNEWVEC (char, string_len); >> } >> + else >> + memset (string, 0, string_len); > > Is this memset still necessary? Of course not ... [...] > If "ptr" is passed

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-05 Thread Dodji Seketeli
eep in mind that in subsequent patches, read_line might be re-used by e.g, gcov in nominal contexts where we don't have zeros in the middle of the line. In that case, speed can be a concern. Thanks for the helpful thoughts. -- Dodji

Re: [PATCH, PR 53001] Re: Patch to split out new warning flag for floating point conversion

2013-11-05 Thread Dodji Seketeli
e_conversion_p): switching return type to conversion_safety enumeration. OK to commit with the above changes, if you have your copyright properly assigned to the FSF. Thank for working on this. It is appreciated. -- Dodji

Re: [PATCH] Put a breakpoint on __asan_report_error for ASAN

2013-12-02 Thread Dodji Seketeli
is is OK, if nobody objects in the next 48h. Thanks. -- Dodji

Re: [PATCH] Allow building if libsanitizer on RHEL5 (i.e. with 2.6.18-ish kernel headers, take 2)

2014-01-09 Thread Dodji Seketeli
| provides a workaround in non-compiler-rt maintained files. Let's get this in then :-) Cheers. -- Dodji

Re: [PATCH] Use libbacktrace for libsanitizer symbolization (take 2, PR sanitizer/59136)

2014-01-09 Thread Dodji Seketeli
hen. I am little bit concerned about the maintenance cost of this over time. I guess we can figure out a way to factorize libbacktrace if the cost of its maintenance really rises. > Regtested on x86_64-linux (--target_board=unix\{-m32,-m64\}), ok for > trunk (will do full bootstrap/regtest momentarily)? Looks good to me. Thank you. -- Dodji

Re: [PATCH] libsanitizer demangling using cp-demangle.c

2014-01-09 Thread Dodji Seketeli
cmp, > __asan_internal_strncmp): New functions. > * sanitizer_common/Makefile.in: Regenerated. > * libbacktrace/Makefile.in: Regenerated. > * configure: Regenerated. > * configure.ac: Regenerated. > * config.h.in: Regenerated. This looks good to me. Thanks. -- Dodji

Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2)

2015-09-25 Thread Dodji Seketeli
u noticed anythying related to that during bootstrap? Cheers, -- Dodji

Re: [PATCH 3/5] Implement token range tracking within libcpp and the C FE (v2)

2015-09-25 Thread Dodji Seketeli
therwise, if we could do away with duplicating the start location and still miminize the churn, maybe we should try. -- Dodji

Re: PR pretty-print/67567 do not pass NULL as a string

2015-09-25 Thread Dodji Seketeli
Manuel López-Ibáñez a écrit: > 2015-09-15 Manuel López-Ibáñez > > PR pretty-print/67567 > * resolve.c (resolve_fl_procedure): Work-around when iface->module > == NULL. This is OK, thanks. -- Dodji

Re: [PATCH 4/5] Implement tree expression tracking in C FE (v2)

2015-09-25 Thread Dodji Seketeli
ge +get_decl_source_range (tree decl) +{ Likewise. -- Dodji

Re: [RFC PATCH] parse #pragma GCC diagnostic in libcpp

2015-09-25 Thread Dodji Seketeli
it into a flag which type is an enum that says how the the pragma is to be handled; either internally and its tokens shouldn't be visible to the FE (this is what the current pragma_entry::is_internal means), internally and the tokens would be visible to the FE, or deferred. Then do do_pragma() would be adjusted to change the if (p->is_deferred) clause to allow the third handling kind I just talked about. I hope this helps. Cheers, -- Dodji

Re: [PATCH 3/5] Implement token range tracking within libcpp and the C FE (v2)

2015-09-25 Thread Dodji Seketeli
David Malcolm a écrit: > On Fri, 2015-09-25 at 11:13 +0200, Dodji Seketeli wrote: [...] >> Funny; I first overlooked this comment of you, and then when reading the >> patch, I asked myself "why keep the existing location_t" ? I mean, in >> here: >> >&g

Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2)

2015-09-25 Thread Dodji Seketeli
Manuel López-Ibáñez a écrit: > On 25 September 2015 at 10:51, Dodji Seketeli wrote: >> The line-map parts are OK to me too, but I have no power on those. So I > > You are listed as "line map" maintainer in MAINTAINERS. I rooted for > you! :) Right, I meant the libc

Re: [PATCH 4/5] Implement tree expression tracking in C FE (v2)

2015-09-25 Thread Dodji Seketeli
David Malcolm a écrit: > On Fri, 2015-09-25 at 16:06 +0200, Dodji Seketeli wrote: >> Hello, >> >> Similarly to a comment I made on the previous patch of the series, >> >> +++ b/libcpp/include/line-map.h >> >> [...] >> >> struc

Re: [PATCH] v3 of diagnostic_show_locus and rich_location (was Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2))

2015-09-26 Thread Dodji Seketeli
oday, FEs emits diagnostics with ranges that always starts with a caret. But I think it's easy to imagine hypothetic (and reasonably probable) examples where we'd have only one range with a caret, associated to other ranges with no caret. The ranges with no carets would thus require the show_caret_p argument to be non-null. In fact, patch 2/5 has one of these examples in a comment in line-map.h: + Example C + * + a = (foo && bar) + ~~~ ^~ ~~~ + This rich location has three ranges: + - Range 0 has its caret and start location at the first "&" and + end at the second "&. + - Range 1 has its start and finish at the "f" and "o" of "foo"; + the caret is not flagged for display, but is perhaps at the "f" + of "foo". + - Similarly, range 2 has its start and finish at the "b" and "r" of + "bar"; the caret is not flagged for display, but is perhaps at the + "b" of "bar". We'll then start seeing cases with show_caret_p being false when *new* diagnostics are added to FEs to leverage on this new feature. So I don't think this "show_caret_p" argument's value is an issue, quite the contrary; it's an interesting feature. Cheers, -- Dodji

Re: [RFC PATCH] parse #pragma GCC diagnostic in libcpp

2015-09-26 Thread Dodji Seketeli
Manuel López-Ibáñez writes: > On 25 September 2015 at 17:14, Dodji Seketeli wrote: >> The caller of do_pragma(), which is destringize_and_run() then detects >> that pfile->directive_result.type is set, and then puts the tokens of >> the pragma back into the input stream

Re: [PATCH 5/5] Add plugin to recursively dump the source-ranges in a tree (v2)

2015-09-27 Thread Dodji Seketeli
ugin/diagnostic_plugin_show_trees.c: New file. > * gcc.dg/plugin/plugin.exp (plugin_test_list): Add > diagnostic_plugin_show_trees.c and > diagnostic-test-show-trees-1.c. For what it's worth, this looks good to me. Thanks! -- Dodji

Re: [PATCH 10/10] Compress short ranges into source_location

2015-11-04 Thread Dodji Seketeli
|| locus >= LINEMAPS_MACRO_LOWEST_LOCATION (set) not part of pure_location_p() ? I mean, would it make sense to say that a locus that that satisfies that condition is pure? By the way, I like this great piece of code of yours, kudos! Cheers, -- Dodji

Re: Status of rich location work (was Re: [PATCH 06/10] Track expression ranges in C frontend)

2015-11-05 Thread Dodji Seketeli
> Talking about risks: the reduction of the space for ordinary maps by a > factor of 32, by taking up 5 bits for the packed range information > optimization (patch 10): > https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02539.html > CCing Dodji: Dodji; is this reasonable? FWIW, I a

Re: [PATCH Fortran/Diagnostics] Move Fortran to common diagnostics machinery

2014-08-08 Thread Dodji Seketeli
tern. Small nit; the diagnostic.[ch] files are in gcc/, not in c-family. The language-agnostic diagnostic infrastructure changes otherwise look OK to me. Thanks. -- Dodji

Re: [PATCH] PR preprocessor/61817 - Fix location of tokens in built-in macro expansion list

2014-08-11 Thread Dodji Seketeli
E__ expands to accordlingly. (builtin_macro): Use cpp_force_token_locations() to set the location of the resulting token to that expansion point location. (enter_macro_context): Pass the expansion point locatoin to builtin_macro. gcc/testsuite/ *

Re: [C PATCH] Diagnose predefined identifiers in pedantic mode

2014-08-11 Thread Dodji Seketeli
79c830e..c234470 100644 > --- gcc/testsuite/gcc.dg/pr33676.c > +++ gcc/testsuite/gcc.dg/pr33676.c > @@ -1,4 +1,5 @@ > /* { dg-do run } */ > +/* { dg-options "" } */ > /* { dg-options "-O0 -mtune=i386 -fomit-frame-pointer" { target { { i?86-*-* > x86_64-*-* } && ia32 } } } */ Likewise. Cheers. -- Dodji

Re: [C PATCH] Diagnose predefined identifiers in pedantic mode

2014-08-12 Thread Dodji Seketeli
l. Oh, I see. Thanks. Maybe a comment there would be helpful then :-) Thanks. -- Dodji

Re: [PATCH] Handle -fsanitize=leak more similarly to address/thread

2014-08-17 Thread Dodji Seketeli
fsanitize=leak. This looks OK to me. Thanks! -- Dodji

Re: [PATCH] Fix UB in diagnostic.c

2014-08-17 Thread Dodji Seketeli
gt; Yea, I think this would be much better, thanks. Done in the > following. Yes, I agree with this as well. > Bootstrapped/regtested on x86_64-linux, ok for trunk? Yes, this is OK to me. Thank you for looking into this. Cheers. -- Dodji

Re: [PATCH] Move caret printing to diagnostics_finalizer

2014-08-19 Thread Dodji Seketeli
> Bootstrapped and regression tested on x86-64-linux. > > OK? This is OK for me. Please commit it if nobody objects in the next 48 hours. Thank you :-) Cheers. -- Dodji

Re: [PATCH diagnostics/Fortran] Implement Fortran prefix/caret style using the common diagnostics machinery

2014-08-20 Thread Dodji Seketeli
ew > line is needed. > * diagnostic.h (struct diagnostic_context): > Bootstrapped and regression tested on x86_64-linux-gnu. > > OK? The generic diagnostics part is OK. Thanks! Cheers. -- Dodji

Re: [PATCH/PR c/59304] #pragma diagnostic pop after warning fails for options unspecified in the command-line and disabled by default

2014-08-20 Thread Dodji Seketeli
ommand-line status. > > gcc/testsuite/ChangeLog: > > 2014-08-19 Manuel López-Ibáñez > > PR c/59304 > * gcc.dg/pr59304.c: New test. Thank you! -- Dodji

[PATCH] Factorize the two read_line functions present in gcov.c and input.c

2013-11-06 Thread Dodji Seketeli
buffer = ptr; lines++; diff --git a/gcc/input.h b/gcc/input.h index 128e28c..d7c8a0e 100644 --- a/gcc/input.h +++ b/gcc/input.h @@ -66,4 +66,6 @@ extern location_t input_location; void dump_line_table_statistics (void); +const char * read_line (FILE *, int *); + #endif -- Dodji

Re: [PATCH] Factorize the two read_line functions present in gcov.c and input.c

2013-11-07 Thread Dodji Seketeli
Changelog doesn't match diff. (function names wrong, no mention of gcov) Woops, sorry about that. The second patch attached is an update that should address that. And with the changes in the first patch, this new factorization patch is smaller. Jakub Jelinek writes: > On Thu, Nov

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-11 Thread Dodji Seketeli
+-common/cpp/warning-zero-in-literals-1.c new file mode 100644 index ..ff2ed962ac96e47ae05b0b040f4e10b8e09637e2 GIT binary patch literal 240 zcmdPbSEyDinfo_ordinary.used == 0) +return false; + + /* Now look for the last ordinary map created for FILE_NAME. */ + int i; + for (i = set->info_ordinary.used - 1; i >= 0; --i) +{ + const char *fname = set->info_ordinary.maps[i].d.ordinary.to_file; + if (fname && !strcmp (fname, file_name)) + break; +} + + if (i < 0) +return false; + + /* The highest location for a given map is either the starting + location of the next map minus one, or -- if the map is the + latest one -- the highest location of the set. */ + source_location result; + if (i == (int) set->info_ordinary.used - 1) +result = set->highest_location; + else +result = set->info_ordinary.maps[i].start_location - 1; + + *loc = result; + return true; +} + /* Compute and return statistics about the memory consumption of some parts of the line table SET. */ -- Dodji

[PATCH] Fix asan regtest failures c-c++-common/asan/{memcmp-1.c,strncpy-overflow-1.c}

2013-11-11 Thread Dodji Seketeli
-overflow on address 0x7fff75df96f4 at pc 0x7f98ecbab68b bp 0x7fff75df96b0 sp 0x7fff75df95b8 READ of size 6 at 0x7fff75df96f4 thread T0 #0 0x7f98ecbab68a in __interceptor_memcmp /home/dodji/git/gcc/master/libsanitizer/asan/asan_interceptors.cc:295 (discriminator 7) #1 0x7f98ecbb6393 in

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-11 Thread Dodji Seketeli
smallest counter? Hehe, the LRU idea occurred to me too, but I dismissed the idea as something probably over-engineered. But now that you are mentioning it I guess I should give it a try ;-) I'll post a patch about that later then. >> + fcache * r = lookup_file_in_cache_tab (file_path); >> + if (r == NULL) > > Formatting (no space after *, extra space after ==). Fixed in my local copy. Thanks. -- Dodji

Re: [PATCH] Fix asan regtest failures c-c++-common/asan/{memcmp-1.c,strncpy-overflow-1.c}

2013-11-11 Thread Dodji Seketeli
Jakub Jelinek writes: > On Mon, Nov 11, 2013 at 03:01:53PM +0100, Dodji Seketeli wrote: >> Since a couple of days I am seeing failure on the tests above on my >> Fedora system. The errors look like: >> >> FAIL: c-c++-common/asan/memcmp-1.c -

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-12 Thread Dodji Seketeli
testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c b/gcc/testsuite/c-c++-common/cpp/warning-zero-in-literals-1.c new file mode 100644 index ..ff2ed962ac96e47ae05b0b040f4e10b8e09637e2 GIT binary patch literal 240 zcmdPbSEyDinfo_ordinary.used == 0) +return false; + + /* Now look for the last ordinary map created for FILE_NAME. */ + int i; + for (i = set->info_ordinary.used - 1; i >= 0; --i) +{ + const char *fname = set->info_ordinary.maps[i].d.ordinary.to_file; + if (fname && !strcmp (fname, file_name)) + break; +} + + if (i < 0) +return false; + + /* The highest location for a given map is either the starting + location of the next map minus one, or -- if the map is the + latest one -- the highest location of the set. */ + source_location result; + if (i == (int) set->info_ordinary.used - 1) +result = set->highest_location; + else +result = set->info_ordinary.maps[i + 1].start_location - 1; + + *loc = result; + return true; +} + /* Compute and return statistics about the memory consumption of some parts of the line table SET. */ -- Dodji

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-12 Thread Dodji Seketeli
al copy. Thanks. > You copy one char too much and set it to zero? It's not one char too much. That char is the terminal '\n' in most cases. > Using -- on a value that goes out of scope looks > awkward IMHO. I don't understand this sentence. What do you mean by "Using -- on a value that goes out of scope"? -- Dodji

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-13 Thread Dodji Seketeli
copying is less surprising. And from what I could see from the tests I have done, the copying doesn't make the thing slower than without the patch. So I'd like to keep this unless folks have very strong feeling about it. -- Dodji

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-13 Thread Dodji Seketeli
ile, so that there is no buffer overflow here. -- Dodji

Re: [patch] Fix ICEs when DEBUG_MANGLE is enabled

2013-11-14 Thread Dodji Seketeli
; S%s_ = ", to_base36 (i - 1)); if (TYPE_P (el) && (CP_TYPE_RESTRICT_P (el) || CP_TYPE_VOLATILE_P (el) -- Dodji

Re: [PATCH] preprocessor/58580 - preprocessor goes OOM with warning for zero literals

2013-11-14 Thread Dodji Seketeli
Jakub Jelinek writes: > On Tue, Nov 12, 2013 at 04:33:41PM +0100, Dodji Seketeli wrote: >> + >> + memmove (*line, l, len); >> + (*line)[len - 1] = '\0'; >> + *line_len = --len; > > Shouldn't this be testing that len > 0 &

Re: [PATCH] Asan constructor init order checking

2013-11-22 Thread Dodji Seketeli
above) we are un-poisoning all dynamically initialized global variables. Also, do we have some tests for this? I am not sure how I'd write multi-tu dejagnu tests for this myself though ;-) Other than that, LGTM. Thanks. -- Dodji

Re: [PATCH] Asan constructor init order checking

2013-11-22 Thread Dodji Seketeli
Dodji Seketeli writes: > Also, do we have some tests for this? I am not sure how I'd write > multi-tu dejagnu tests for this myself though ;-) Woops, I have just seen the sub-thread about the tests with Konstantin, you and Alexey. Sorry. Cheers. -- Dodji

Re: [PATCH] Asan constructor init order checking

2013-11-22 Thread Dodji Seketeli
Jakub Jelinek writes: > On Fri, Nov 22, 2013 at 04:38:58PM +0100, Dodji Seketeli wrote: >> Jakub Jelinek writes: >> >> > --- gcc/cgraph.h.jj2013-11-13 18:32:52.0 +0100 >> > +++ gcc/cgraph.h 2013-11-15 12:05:25.950985500 +0100 >>

  1   2   3   4   5   6   >