public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6
@ 2004-03-21 14:10 wanderer at rsu dot ru
  2004-03-21 14:11 ` [Bug optimization/14669] " wanderer at rsu dot ru
                   ` (22 more replies)
  0 siblings, 23 replies; 24+ messages in thread
From: wanderer at rsu dot ru @ 2004-03-21 14:10 UTC (permalink / raw)
  To: gcc-bugs

Wrong code with -O for enum values expression E4 <= t && t <= E6

Current mainline CVS g++ (gcc version 3.5.0 20040320) and
current 3.4      CVS g++ (gcc version 3.4.0 20040321)
produce wrong code for program with optimization (g++ -O Test.cc command line):

---8X---------------------------
#include<iostream>

enum Enum { EE =-1, E0 = 0, E1, E2, E3, E4, E5, E6, E7 };

int main() {
  Enum t = E2; 

  bool f = E4 <= t && t <= E6;

  std::cout << "Expr1: False = " << (f  ? "True" : "False") << std::endl;

  bool f1 = E4 <= t;
  bool f2 = t  <= E6;
  bool ff = f1 && f2;

  std::cout << "Expr2: False = " << (ff ? "True" : "False") << std::endl;

  return 0;
}
--X8-----------------------
Program compiled with optimization (g++ -O Test.cc) output:
Expr1: False = True
Expr2: False = False

Program compiled without optimization (g++ Test.cc) output (correct):
Expr1: False = False
Expr2: False = False

gcc version 3.2.2 [FreeBSD] 20030205 (release) doesn't have this problem.

Initial for testcase source code have been compiled and work without this 
problem at some days old version of GCC mainline.

-- 
           Summary: Wrong code with -O for enum values expression E4 <= t &&
                    t <= E6
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wanderer at rsu dot ru
                CC: gcc-bugs at gcc dot gnu dot org,mark at codesourcery dot
                    com
 GCC build triplet: i386-unknown-freebsd5.1
  GCC host triplet: i386-unknown-freebsd5.1
GCC target triplet: i386-unknown-freebsd5.1


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
@ 2004-03-21 14:11 ` wanderer at rsu dot ru
  2004-03-21 14:13 ` wanderer at rsu dot ru
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: wanderer at rsu dot ru @ 2004-03-21 14:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wanderer at rsu dot ru  2004-03-21 14:11 -------
Created an attachment (id=5957)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5957&action=view)
source file


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
  2004-03-21 14:11 ` [Bug optimization/14669] " wanderer at rsu dot ru
@ 2004-03-21 14:13 ` wanderer at rsu dot ru
  2004-03-21 14:14 ` wanderer at rsu dot ru
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: wanderer at rsu dot ru @ 2004-03-21 14:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wanderer at rsu dot ru  2004-03-21 14:13 -------
Created an attachment (id=5958)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5958&action=view)
.ii file ( g++ -save-temps -O Test.cc)


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
  2004-03-21 14:11 ` [Bug optimization/14669] " wanderer at rsu dot ru
  2004-03-21 14:13 ` wanderer at rsu dot ru
@ 2004-03-21 14:14 ` wanderer at rsu dot ru
  2004-03-21 15:28 ` wanderer at rsu dot ru
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: wanderer at rsu dot ru @ 2004-03-21 14:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wanderer at rsu dot ru  2004-03-21 14:14 -------
Created an attachment (id=5959)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5959&action=view)
.s file ( g++ -save-temps -O Test.cc)


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (2 preceding siblings ...)
  2004-03-21 14:14 ` wanderer at rsu dot ru
@ 2004-03-21 15:28 ` wanderer at rsu dot ru
  2004-03-21 15:31 ` [Bug optimization/14669] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: wanderer at rsu dot ru @ 2004-03-21 15:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From wanderer at rsu dot ru  2004-03-21 15:27 -------
Current 3.3 CVS g++ (gcc version 3.3.4 20040321) doesn't have this problem.

Output for g++ -O Test.cc:
Expr1: False = False
Expr2: False = False


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (3 preceding siblings ...)
  2004-03-21 15:28 ` wanderer at rsu dot ru
@ 2004-03-21 15:31 ` pinskia at gcc dot gnu dot org
  2004-03-21 17:34 ` mmitchel at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-21 15:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-21 15:31 -------
In fact it worked earlier this year (3.4.0 20040116):
Expr1: False = 0.
Expr2: False = 0.
Confirmed on a mainline compiler built today.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-21 15:31:43
               date|                            |
            Summary|Wrong code with -O for enum |[3.4/3.5 Regression] Wrong
                   |values expression E4 <= t &&|code with -O for enum values
                   |t <= E6                     |expression E4 <= t && t <=
                   |                            |E6
   Target Milestone|---                         |3.4.1


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (4 preceding siblings ...)
  2004-03-21 15:31 ` [Bug optimization/14669] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-03-21 17:34 ` mmitchel at gcc dot gnu dot org
  2004-03-21 22:14 ` kazu at cs dot umass dot edu
                   ` (16 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-21 17:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-03-21 17:34 -------
This is a serious bug; retargeted for 3.4.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4.1                       |3.4.0


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (5 preceding siblings ...)
  2004-03-21 17:34 ` mmitchel at gcc dot gnu dot org
@ 2004-03-21 22:14 ` kazu at cs dot umass dot edu
  2004-03-21 22:21 ` kazu at cs dot umass dot edu
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-21 22:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-21 22:14 -------
This patch seems to have caused the problem.

http://gcc.gnu.org/ml/gcc-cvs/2004-02/msg00387.html


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kazu at cs dot umass dot edu


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (6 preceding siblings ...)
  2004-03-21 22:14 ` kazu at cs dot umass dot edu
@ 2004-03-21 22:21 ` kazu at cs dot umass dot edu
  2004-03-21 23:06 ` kazu at cs dot umass dot edu
                   ` (14 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-21 22:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-21 22:21 -------
Reduced to:

extern "C" {
void abort (void) __attribute__((__noreturn__));
void exit (int) __attribute__((__noreturn__));
}

enum ActionType { EE =-1, E0 = 0, E1, E2 };

int
main (void)
{
  ActionType t = E0;

  if (E1 <= t && t <= E2)
    abort ();

  exit (0);
}


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (7 preceding siblings ...)
  2004-03-21 22:21 ` kazu at cs dot umass dot edu
@ 2004-03-21 23:06 ` kazu at cs dot umass dot edu
  2004-03-21 23:10 ` kazu at cs dot umass dot edu
                   ` (13 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-21 23:06 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-21 23:06 -------
Here is what the toplevel (that is, not recursive part) fold is doing:
The left hand side is without Roger's patch.
The right hand side is with Roger's patch.

original-----------						original-----------
 <truth_andif_expr 						 <truth_andif_expr 
    type <boolean_type  bool unsigned QI			    type <boolean_type  bool unsigned QI
        size <integer_cst  constant 8>				        size <integer_cst  constant 8>
        unit size <integer_cst  constant 1>			        unit size <integer_cst 
constant 1>
        align 8 symtab 0 alias set -1 precision 1 min <intege	        align 8
symtab 0 alias set -1 precision 1 min <intege
   								   
    arg 0 <gt_expr  type <boolean_type  bool>			    arg 0 <gt_expr  type
<boolean_type  bool>
       								       
        arg 0 <var_decl  t type <enumeral_type  ActionType>	        arg 0
<var_decl  t type <enumeral_type  ActionType>
            used tree_1 tree_2 SI file pr14669-1.c line 11	            used
tree_1 tree_2 SI file pr14669-1.c line 11
            size <integer_cst  constant 32>			            size <integer_cst 
constant 32>
            unit size <integer_cst  constant 4>			            unit size
<integer_cst  constant 4>
            align 32 context <function_decl  main> initial <i	            align
32 context <function_decl  main> initial <i
        arg 1 <integer_cst  constant 0>>			        arg 1 <integer_cst  constant 0>>
    arg 1 <le_expr  type <boolean_type  bool>			    arg 1 <le_expr  type
<boolean_type  bool>
        arg 0 <var_decl  t>					        arg 0 <var_decl  t>
        arg 1 <integer_cst  constant 2>>>			        arg 1 <integer_cst  constant
2>>>
folded-------------						folded-------------
 <le_expr 							 <le_expr 
    type <boolean_type  bool unsigned QI			    type <boolean_type  bool unsigned QI
        size <integer_cst  constant 8>				        size <integer_cst  constant 8>
        unit size <integer_cst  constant 1>			        unit size <integer_cst 
constant 1>
        align 8 symtab 0 alias set -1 precision 1 min <intege	        align 8
symtab 0 alias set -1 precision 1 min <intege
   								   
    arg 0 <convert_expr 				      |	    arg 0 <minus_expr 
        type <integer_type  unsigned int unsigned SI	      |	        type
<enumeral_type  ActionType SI
            size <integer_cst  constant 32>			            size <integer_cst 
constant 32>
            unit size <integer_cst  constant 4>			            unit size
<integer_cst  constant 4>
            align 32 symtab 0 alias set -1 precision 32 min < |	           
align 32 symtab 0 alias set -1 precision 3 min <i
							      >	            values <tree_list 
							      >	                purpose <identifier_node  EE
							      >	                bindings <>
							      >	                local bindings <(nil)>>
							      >	                value <integer_cst  constant -1>
							      >	                chain <tree_list 
							      >	                    purpose <identifier_node  E0
							      >	                    bindings <>
							      >	                    local bindings <(nil)>>
							      >	                    value <integer_cst  constant 0>
							      >	                    chain <tree_list 
							      >	                        purpose <identifier_node  E1
							      >	                        bindings <>
							      >	                        local bindings <(nil)>>
							      >	                        value <integer_cst  constant 1>
							      >	                        chain <tree_list  purpose <identifier
							      >	            chain <type_decl  ActionType>>
       								       
        arg 0 <minus_expr  type <enumeral_type  ActionType>   |	        arg 0
<var_decl  t type <enumeral_type  ActionType>
            arg 0 <var_decl  t>				      |	            used tree_1 tree_2 SI
file pr14669-1.c line 11 si
            arg 1 <integer_cst  constant 1>>>		      |	            align 32
context <function_decl  main> initial <i
    arg 1 <integer_cst  type <integer_type  unsigned int> con |	        arg 1
<integer_cst  constant 1>>
							      >	    arg 1 <integer_cst  type <enumeral_type  ActionType> cons
original-----------						original-----------
 <cleanup_point_expr 						 <cleanup_point_expr 
    type <boolean_type  bool unsigned QI			    type <boolean_type  bool unsigned QI
        size <integer_cst  constant 8>				        size <integer_cst  constant 8>
        unit size <integer_cst  constant 1>			        unit size <integer_cst 
constant 1>
        align 8 symtab 0 alias set -1 precision 1 min <intege	        align 8
symtab 0 alias set -1 precision 1 min <intege
   								   
    arg 0 <le_expr  type <boolean_type  bool>			    arg 0 <le_expr  type
<boolean_type  bool>
       								       
        arg 0 <convert_expr  type <integer_type  unsigned int |	        arg 0
<minus_expr  type <enumeral_type  ActionType>
           						      |	            arg 0 <var_decl  t>
            arg 0 <minus_expr  type <enumeral_type  ActionTyp |	            arg
1 <integer_cst  constant 1>>
                arg 0 <var_decl  t>			      <
                arg 1 <integer_cst  constant 1>>>	      <
        arg 1 <integer_cst  constant 1>>>			        arg 1 <integer_cst  constant
1>>>
folded-------------						folded-------------
 <le_expr 							 <le_expr 
    type <boolean_type  bool unsigned QI			    type <boolean_type  bool unsigned QI
        size <integer_cst  constant 8>				        size <integer_cst  constant 8>
        unit size <integer_cst  constant 1>			        unit size <integer_cst 
constant 1>
        align 8 symtab 0 alias set -1 precision 1 min <intege	        align 8
symtab 0 alias set -1 precision 1 min <intege
   								   
    arg 0 <convert_expr 				      |	    arg 0 <minus_expr 
        type <integer_type  unsigned int unsigned SI	      |	        type
<enumeral_type  ActionType SI
            size <integer_cst  constant 32>			            size <integer_cst 
constant 32>
            unit size <integer_cst  constant 4>			            unit size
<integer_cst  constant 4>
            align 32 symtab 0 alias set -1 precision 32 min < |	           
align 32 symtab 0 alias set -1 precision 3 min <i
							      >	            values <tree_list 
							      >	                purpose <identifier_node  EE
							      >	                bindings <>
							      >	                local bindings <(nil)>>
							      >	                value <integer_cst  constant -1>
							      >	                chain <tree_list 
							      >	                    purpose <identifier_node  E0
							      >	                    bindings <>
							      >	                    local bindings <(nil)>>
							      >	                    value <integer_cst  constant 0>
							      >	                    chain <tree_list 
							      >	                        purpose <identifier_node  E1
							      >	                        bindings <>
							      >	                        local bindings <(nil)>>
							      >	                        value <integer_cst  constant 1>
							      >	                        chain <tree_list  purpose <identifier
							      >	            chain <type_decl  ActionType>>
       								       
        arg 0 <minus_expr  type <enumeral_type  ActionType>   |	        arg 0
<var_decl  t type <enumeral_type  ActionType>
            arg 0 <var_decl  t>				      |	            used tree_1 tree_2 SI
file pr14669-1.c line 11 si
            arg 1 <integer_cst  constant 1>>>		      |	            align 32
context <function_decl  main> initial <i
    arg 1 <integer_cst  type <integer_type  unsigned int> con |	        arg 1
<integer_cst  constant 1>>
							      >	    arg 1 <integer_cst  type <enumeral_type  ActionType> cons



-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (8 preceding siblings ...)
  2004-03-21 23:06 ` kazu at cs dot umass dot edu
@ 2004-03-21 23:10 ` kazu at cs dot umass dot edu
  2004-03-21 23:12 ` steven at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-21 23:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-21 23:10 -------
Some lines in Comment #9 was messed up,
so I posted the same stuff as an attachment (see Comment #10).


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (9 preceding siblings ...)
  2004-03-21 23:10 ` kazu at cs dot umass dot edu
@ 2004-03-21 23:12 ` steven at gcc dot gnu dot org
  2004-03-21 23:34 ` kazu at cs dot umass dot edu
                   ` (11 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-03-21 23:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2004-03-21 23:12 -------
Wrong code, so should be P1. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (10 preceding siblings ...)
  2004-03-21 23:12 ` steven at gcc dot gnu dot org
@ 2004-03-21 23:34 ` kazu at cs dot umass dot edu
  2004-03-22  0:52 ` kazu at cs dot umass dot edu
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-21 23:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-21 23:34 -------
Looking at the fold()'s output (the very first one), here is my guess:

fold() is given TRUTH_ANDIF_EXPR like so

  (t > 0) && (t <= 2)

Without Roger's patch, fold() returns

  (unsigned int) (t - 1) <= 1

With Roger's patch, fold() returns

  (t - 1) <= 1.

If you plug in t = 0, the former becomes false, whereas the latter becomes true.


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (11 preceding siblings ...)
  2004-03-21 23:34 ` kazu at cs dot umass dot edu
@ 2004-03-22  0:52 ` kazu at cs dot umass dot edu
  2004-03-22  6:15 ` roger at eyesopen dot com
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-22  0:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-22 00:52 -------
This bug now seems to be a latent one.
Here is an except from a part of fold() that folds comparisons.

      /* If we are widening one operand of an integer comparison,
	 see if the other operand is similarly being widened.  Perhaps we
	 can do the comparison in the narrower type.  */
      else if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE
	       && TREE_CODE (arg0) == NOP_EXPR
	       && (tem = get_unwidened (arg0, NULL_TREE)) != arg0
	       && (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0
	       && (TREE_TYPE (t1) == TREE_TYPE (tem)
		   || (TREE_CODE (t1) == INTEGER_CST
		       && int_fits_type_p (t1, TREE_TYPE (tem)))))
	return fold (build (code, type, tem,
			    fold_convert (TREE_TYPE (tem), t1)));

Note that the first call to get_unwidened does not preserve signedness.
So if code == LE_EXPR, for example, the meaning of the comparison changes.

I've worked around the problem with the following patch, but this approach
seems lossy, though.  That is, if get_unwidened changes the signdness,
we can restore the signedness back.

Index: fold-const.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/fold-const.c,v
retrieving revision 1.328
diff -u -r1.328 fold-const.c
--- fold-const.c	7 Feb 2004 18:57:29 -0000	1.328
+++ fold-const.c	22 Mar 2004 00:44:15 -0000
@@ -7599,6 +7599,9 @@
       else if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE
 	       && TREE_CODE (arg0) == NOP_EXPR
 	       && (tem = get_unwidened (arg0, NULL_TREE)) != arg0
+	       && (code == EQ_EXPR || code == NE_EXPR
+		   || (TREE_UNSIGNED (TREE_TYPE (arg0))
+		       == TREE_UNSIGNED (TREE_TYPE (tem))))
 	       && (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0
 	       && (TREE_TYPE (t1) == TREE_TYPE (tem)
 		   || (TREE_CODE (t1) == INTEGER_CST

To address the above issue, I wrote another patch like so

Index: fold-const.c
===================================================================
RCS file: /home/kazu/nobackup/gcc-cvs/gcc/gcc/fold-const.c,v
retrieving revision 1.328
diff -u -r1.328 fold-const.c
--- fold-const.c	7 Feb 2004 18:57:29 -0000	1.328
+++ fold-const.c	22 Mar 2004 00:40:23 -0000
@@ -7599,6 +7599,9 @@
       else if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE
 	       && TREE_CODE (arg0) == NOP_EXPR
 	       && (tem = get_unwidened (arg0, NULL_TREE)) != arg0
+	       && (tem = (TREE_UNSIGNED (TREE_TYPE (arg0))
+			  ? fold_convert (lang_hooks.types.unsigned_type (TREE_TYPE (tem)), tem)
+			  : fold_convert (lang_hooks.types.signed_type   (TREE_TYPE (tem)), tem)))
 	       && (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0
 	       && (TREE_TYPE (t1) == TREE_TYPE (tem)
 		   || (TREE_CODE (t1) == INTEGER_CST

But GCC with this patch segfaults.  Seems like it goes into an infinite
recursion or something.


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (12 preceding siblings ...)
  2004-03-22  0:52 ` kazu at cs dot umass dot edu
@ 2004-03-22  6:15 ` roger at eyesopen dot com
  2004-03-22 15:19 ` roger at eyesopen dot com
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: roger at eyesopen dot com @ 2004-03-22  6:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2004-03-22 06:15 -------
Hi Kazu,
I agree with your analysis that this was a latent problem in fold exposed by
my fold_convert change.  To prevent the unbounded recursion with your patch you
also need to check that TREE_TYPE (tem) != TREE_TYPE (arg0), [ow whatever the
correct type comparison is].  I suspect that lang_hooks.types.{un}signed_type is
returning a widening type, hence the call to recursive call to fold triggers the
exact same transformation.

On expressions such as (unsigned)x < 1, it is often impossible to remove the
NOP_EXPR as it's required to determine the width and signedness of the
comparison.

Perhaps another solution to the recursion is to add the following clause:

 	       && (tem = get_unwidened (arg0, NULL_TREE)) != arg0
+	       && (tem = (TREE_UNSIGNED (TREE_TYPE (arg0))
+			  ? fold_convert (lang_hooks.types.unsigned_type ...
+			  : fold_convert (lang_hooks.types.signed_type ...
>>>            && get_unwidened (tem, NULL_TREE) == tem 
 	       && (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0

It might also be worthwhile calling lang_hooks.types.{un}signed_type if
TREE_UNSIGNED (TREE_TYPE (arg0)) != TREE_UNSIGNED (TREE_TYPE (tem)), as
tested in your first version.  Similarly, we could also avoid these calls
for EQ_EXPR and NE_EXPR, its only the ordering comparisons that require
that we cast the operands back to the correctly signed type.

Sorry for the inconvenience, but it looks like you're/we're close to a fix.


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (13 preceding siblings ...)
  2004-03-22  6:15 ` roger at eyesopen dot com
@ 2004-03-22 15:19 ` roger at eyesopen dot com
  2004-03-22 15:53 ` kazu at cs dot umass dot edu
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: roger at eyesopen dot com @ 2004-03-22 15:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2004-03-22 15:19 -------
This is a variant of Kazu's patch that I'm bootstrapping and reg-testing:

         can do the comparison in the narrower type.  */
        else if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE
               && TREE_CODE (arg0) == NOP_EXPR
!              && (tem = get_unwidened (arg0, NULL_TREE)) != arg0)
!       {
!         /* We need to preserve the signedness of ordered comparisons.  */
!         if (code != EQ_EXPR && code != NE_EXPR
!             && TREE_UNSIGNED (TREE_TYPE (arg0))
!                != TREE_UNSIGNED (TREE_TYPE (tem)))
!           {
!             tree ntype = TREE_UNSIGNED (TREE_TYPE (arg0))
!                          ? lang_hooks.types.unsigned_type (TREE_TYPE (tem))
!                          : lang_hooks.types.signed_type (TREE_TYPE (tem));
!             tem = fold_convert (ntype, tem);
!             /* If preserving signedness rewidens the type, skip this
!                transformation to avoid unbounded recursion.  */
!             if (get_unwidened (tem, NULL_TREE) != tem)
!               tem = NULL_TREE;
!           }
!
!         if (tem
!             && (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0
!             && (TREE_TYPE (t1) == TREE_TYPE (tem)
!                 || (TREE_CODE (t1) == INTEGER_CST
!                     && int_fits_type_p (t1, TREE_TYPE (tem)))))
!           return fold (build (code, type, tem,
!                               fold_convert (TREE_TYPE (tem), t1)));
!       }

        /* If this is comparing a constant with a MIN_EXPR or a MAX_EXPR of a
         constant, we can simplify it.  */


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (14 preceding siblings ...)
  2004-03-22 15:19 ` roger at eyesopen dot com
@ 2004-03-22 15:53 ` kazu at cs dot umass dot edu
  2004-03-22 17:58 ` roger at eyesopen dot com
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-22 15:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-22 15:52 -------
Roger,

Thank you very much for following up on my incomplete patches.

One small thing I've noticed is that the outer scope has a rather long chain
of "else if".  For the chain to work correctly, whenever you notice an
optimization opportunity with "if (...)", you have to take the opportunity.
In other words, you cannot have something like this:

else if (condition)
  {
    if (more condition)
      return blah;   
  }

because those "if"s later in the chain may be applicable to the expression
you are currently looking at.

It turns out that in this particular case, the above issue does not matter
because you are checking that TREE_CODE (arg0) == NOP_EXPR, and none of the
optimizations later in the chain are not applicable when
TREE_CODE (arg0) == NOP_EXPR.

I will submit a patch to address this issue for mainline.

-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (15 preceding siblings ...)
  2004-03-22 15:53 ` kazu at cs dot umass dot edu
@ 2004-03-22 17:58 ` roger at eyesopen dot com
  2004-03-23 14:20 ` roger at eyesopen dot com
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: roger at eyesopen dot com @ 2004-03-22 17:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2004-03-22 17:58 -------
Argh!  The patch variant described in comment #16 cures this failure, and passes
all of the regression suite except ACATS cxa3003 and cxa3004.  I'm not sure if
these are some other latent problem, but I'm investigating further...

-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (16 preceding siblings ...)
  2004-03-22 17:58 ` roger at eyesopen dot com
@ 2004-03-23 14:20 ` roger at eyesopen dot com
  2004-03-23 14:27 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: roger at eyesopen dot com @ 2004-03-23 14:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From roger at eyesopen dot com  2004-03-23 14:19 -------
Many thanks to Eric Botcazou for analyzing ACATS' cxa3003, which demonstrates
that the signedness recovery optimization below is unsafe.  The example is:

  unsigned char i;
  if ((long long) i <= 127)

which isn't equivalent to

  if ((signed char) i <= 127)

Hence, I'll approve and commit to mainline Kazu's orignal fix, which is attached
to comment #14.  I've confirmed this resolves this PR, and introduces no new 
testsuite failures on i686-pc-linux-gnu after a full bootstrap.  I'll also post
the patch as committed to gcc-patches explaining the check-in.

Ok for 3.4?  I need to check whether this is latent on the gcc-3_3-branch.


-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4/3.5 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (17 preceding siblings ...)
  2004-03-23 14:20 ` roger at eyesopen dot com
@ 2004-03-23 14:27 ` cvs-commit at gcc dot gnu dot org
  2004-03-23 15:20 ` [Bug optimization/14669] [3.4 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-23 14:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-23 14:26 -------
Subject: Bug 14669

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-03-23 14:26:43

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: fold2.C 

Log message:
	2004-03-23  Kazu Hirata  <kazu@cs.umass.edu>
	
	PR optimization/14669
	* fold-const.c (fold): Only unwiden integer comparisons for equality
	or inequality operators, or when the signedness is the same.
	
	* g++.dg/opt/fold2.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3263&r2=2.3264
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.355&r2=1.356
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3630&r2=1.3631
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/fold2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (18 preceding siblings ...)
  2004-03-23 14:27 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-23 15:20 ` pinskia at gcc dot gnu dot org
  2004-03-23 21:30 ` mmitchel at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 24+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-23 15:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-23 15:20 -------
Fixed in 3.5.0 (aka the mainline).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|3.4.0 3.5.0 tree-ssa        |3.4.0
      Known to work|3.3                         |3.3 3.5.0
            Summary|[3.4/3.5 Regression] Wrong  |[3.4 Regression] Wrong code
                   |code with -O for enum values|with -O for enum values
                   |expression E4 <= t && t <=  |expression E4 <= t && t <=
                   |E6                          |E6


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (19 preceding siblings ...)
  2004-03-23 15:20 ` [Bug optimization/14669] [3.4 " pinskia at gcc dot gnu dot org
@ 2004-03-23 21:30 ` mmitchel at gcc dot gnu dot org
  2004-03-23 23:31 ` cvs-commit at gcc dot gnu dot org
  2004-03-23 23:32 ` kazu at cs dot umass dot edu
  22 siblings, 0 replies; 24+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-03-23 21:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-03-23 21:30 -------
OK for 3.4.0.

-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (20 preceding siblings ...)
  2004-03-23 21:30 ` mmitchel at gcc dot gnu dot org
@ 2004-03-23 23:31 ` cvs-commit at gcc dot gnu dot org
  2004-03-23 23:32 ` kazu at cs dot umass dot edu
  22 siblings, 0 replies; 24+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-03-23 23:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-03-23 23:31 -------
Subject: Bug 14669

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	kazu@gcc.gnu.org	2004-03-23 23:31:00

Modified files:
	gcc            : ChangeLog fold-const.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: fold2.C 

Log message:
	gcc/
	PR optimization/14669
	* fold-const.c (fold): Only unwiden integer comparisons for equality
	and inequality operators, or when the signedness doesn't change.
	
	gcc/testsuite/
	PR optimization/14669
	* g++.dg/opt/fold2.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.365&r2=2.2326.2.366
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.322.2.8&r2=1.322.2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.157&r2=1.3389.2.158
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/fold2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [Bug optimization/14669] [3.4 Regression] Wrong code with -O for enum values expression E4 <= t && t <= E6
  2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
                   ` (21 preceding siblings ...)
  2004-03-23 23:31 ` cvs-commit at gcc dot gnu dot org
@ 2004-03-23 23:32 ` kazu at cs dot umass dot edu
  22 siblings, 0 replies; 24+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-03-23 23:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-23 23:32 -------
Now fixed in 3.4.0.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|3.4.0                       |
      Known to work|3.3 3.5.0                   |3.3 3.4.0 3.5.0
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2004-03-23 23:32 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-21 14:10 [Bug optimization/14669] New: Wrong code with -O for enum values expression E4 <= t && t <= E6 wanderer at rsu dot ru
2004-03-21 14:11 ` [Bug optimization/14669] " wanderer at rsu dot ru
2004-03-21 14:13 ` wanderer at rsu dot ru
2004-03-21 14:14 ` wanderer at rsu dot ru
2004-03-21 15:28 ` wanderer at rsu dot ru
2004-03-21 15:31 ` [Bug optimization/14669] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-03-21 17:34 ` mmitchel at gcc dot gnu dot org
2004-03-21 22:14 ` kazu at cs dot umass dot edu
2004-03-21 22:21 ` kazu at cs dot umass dot edu
2004-03-21 23:06 ` kazu at cs dot umass dot edu
2004-03-21 23:10 ` kazu at cs dot umass dot edu
2004-03-21 23:12 ` steven at gcc dot gnu dot org
2004-03-21 23:34 ` kazu at cs dot umass dot edu
2004-03-22  0:52 ` kazu at cs dot umass dot edu
2004-03-22  6:15 ` roger at eyesopen dot com
2004-03-22 15:19 ` roger at eyesopen dot com
2004-03-22 15:53 ` kazu at cs dot umass dot edu
2004-03-22 17:58 ` roger at eyesopen dot com
2004-03-23 14:20 ` roger at eyesopen dot com
2004-03-23 14:27 ` cvs-commit at gcc dot gnu dot org
2004-03-23 15:20 ` [Bug optimization/14669] [3.4 " pinskia at gcc dot gnu dot org
2004-03-23 21:30 ` mmitchel at gcc dot gnu dot org
2004-03-23 23:31 ` cvs-commit at gcc dot gnu dot org
2004-03-23 23:32 ` kazu at cs dot umass dot edu

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).