diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
index e2bdaf6..c41b298 100644
--- src/wp-includes/comment-template.php
+++ src/wp-includes/comment-template.php
@@ -1379,7 +1379,11 @@ function comments_template( $file = '/comments.php', $separate_comments = false
 
 			$top_level_count = $top_level_query->query( $top_level_args );
 
-			$comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
+			if ( $top_level_count && $per_page ) {
+				$comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
+			} else {
+				$comment_args['offset'] = 0;
+			}
 		}
 	}
 
diff --git tests/phpunit/tests/comment/commentsTemplate.php tests/phpunit/tests/comment/commentsTemplate.php
index c26a88b..34ad0e1 100644
--- tests/phpunit/tests/comment/commentsTemplate.php
+++ tests/phpunit/tests/comment/commentsTemplate.php
@@ -128,6 +128,38 @@ class Tests_Comment_CommentsTemplate extends WP_UnitTestCase {
 	}
 
 	/**
+	 * @ticket 40293
+	 */
+	public function test_should_handle_zero_comments_per_page_with_comments_broken_into_pages_and_last_page_displayed_by_default() {
+		$now = time();
+		$p = self::factory()->post->create();
+
+		$comment_1 = self::factory()->comment->create( array(
+			'comment_post_ID' => $p,
+			'comment_content' => '1',
+			'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
+		) );
+		$comment_2 = self::factory()->comment->create( array(
+			'comment_post_ID' => $p,
+			'comment_content' => '2',
+			'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ),
+		) );
+
+		update_option( 'comment_order', 'desc' );
+		update_option( 'default_comments_page', 'newest' ); // last (newest) page displayed by default
+		update_option( 'comments_per_page', '0' );          // top level comments per page
+		update_option( 'page_comments', '1' );              // break comments into pages
+
+		$this->go_to( get_permalink( $p ) );
+		$found = get_echo( 'comments_template' );    
+
+		preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches );
+
+		$found_cids = array_map( 'intval', $matches[1] );
+		$this->assertSame( array( $comment_2, $comment_1 ), $found_cids );
+	}
+
+	/**
 	 * @ticket 8071
 	 */
 	public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest_on_subsequent_pages() {
